KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > util > TagUtilsTests


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.web.util;
18
19 import javax.servlet.jsp.PageContext JavaDoc;
20
21 import junit.framework.TestCase;
22
23 /**
24  * @author Alef Arendsen
25  */

26 public class TagUtilsTests extends TestCase {
27     
28     public void testTagUtils() {
29         // it's simple, test all scope, plus a non-existing one
30
// (which should evaluate to SCOPE_PAGE)
31

32         assertEquals(TagUtils.SCOPE_PAGE, "page");
33         assertEquals(TagUtils.SCOPE_APPLICATION, "application");
34         assertEquals(TagUtils.SCOPE_SESSION, "session");
35         assertEquals(TagUtils.SCOPE_REQUEST, "request");
36         
37         assertEquals(TagUtils.getScope("page"), PageContext.PAGE_SCOPE);
38         assertEquals(TagUtils.getScope("request"), PageContext.REQUEST_SCOPE);
39         assertEquals(TagUtils.getScope("session"), PageContext.SESSION_SCOPE);
40         assertEquals(TagUtils.getScope("application"), PageContext.APPLICATION_SCOPE);
41         assertEquals(TagUtils.getScope("bla"), PageContext.PAGE_SCOPE);
42         
43         try {
44             TagUtils.getScope(null);
45             fail("Null scope, no excpetion thrown!");
46         }
47         catch (IllegalArgumentException JavaDoc e) {
48             // ok
49
}
50     }
51
52 }
53
Popular Tags