KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > junit > TestStaticLink


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

15 package org.apache.tapestry.junit;
16
17 import org.apache.tapestry.engine.ILink;
18 import org.apache.tapestry.link.StaticLink;
19
20 /**
21  * Tests for {@link org.apache.tapestry.link.StaticLink}.
22  *
23  * @author Howard Lewis Ship
24  * @since 3.0
25  */

26
27 public class TestStaticLink extends TapestryTestCase
28 {
29     private static final String JavaDoc URL = "http://host/path";
30
31     ILink l = new StaticLink(URL);
32
33     public void testURL()
34     {
35         assertEquals(URL, l.getURL());
36     }
37
38     public void testAbsoluteURL()
39     {
40         assertEquals(URL, l.getAbsoluteURL());
41     }
42
43     public void testURLWithAnchor()
44     {
45         assertEquals(URL, l.getURL(null, false));
46         assertEquals(URL + "#anchor", l.getURL("anchor", false));
47         assertEquals(URL + "#feeble", l.getURL("feeble", true));
48     }
49
50     public void testAbsoluteURLWithParameters()
51     {
52         assertEquals(URL + "#anchor", l.getAbsoluteURL("scheme", "server", 8080, "anchor", false));
53     }
54
55     public void testGetParameterNames()
56     {
57         assertEquals(null, l.getParameterNames());
58     }
59
60     public void testGetParameterValues()
61     {
62         try
63         {
64             l.getParameterValues("any");
65
66             unreachable();
67         }
68         catch (IllegalArgumentException JavaDoc ex)
69         {
70         }
71     }
72 }
73
Popular Tags