KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > urls > TestURI


1 package org.jahia.urls;
2
3 import junit.framework.*;
4 import java.net.*;
5 import javax.servlet.http.*;
6 import java.io.UnsupportedEncodingException JavaDoc;
7
8 public class TestURI extends TestCase {
9     private URI uRI = null;
10     private final String JavaDoc uriTest1 = "http://login:password@host/path1/path2/filename?name1=value2&name2=value2#fragment";
11     private final String JavaDoc uriTest2 = "http://login:password@host/path1_éàéà/path2_äöü/file name.txt.txtàéàéà?name1_éàéà=value2_éàéàé&name2_öüöüö=value2_öüöüöü#fragment_éèéèéè!";
12
13     protected void setUp() throws Exception JavaDoc {
14         super.setUp();
15         /**@todo verify the constructors*/
16         uRI = new URI();
17     }
18
19     protected void tearDown() throws Exception JavaDoc {
20         uRI = null;
21         super.tearDown();
22     }
23
24     public void testURI() {
25         uRI = new URI();
26         /**@todo fill in the test code*/
27     }
28
29     public void testURI1() {
30         String JavaDoc uri = null;
31         uRI = new URI(uriTest1);
32         String JavaDoc expectedReturn = uriTest1;
33         String JavaDoc actualReturn = uRI.toString();
34         assertEquals("return value", expectedReturn, actualReturn);
35         uRI = new URI(uriTest2);
36         expectedReturn = uriTest2;
37         try {
38             System.out.println(uriTest2);
39             System.out.println("becomes with .toString(\"UTF-8\")");
40             System.out.println(uRI.toString("UTF-8"));
41             actualReturn = URICodec.decode(uRI.toString("UTF-8"), "UTF-8");
42             assertEquals("return value", expectedReturn, actualReturn);
43         } catch (UnsupportedEncodingException JavaDoc uee) {
44             uee.printStackTrace();
45         }
46         try {
47             System.out.println(uriTest2);
48             System.out.println("becomes with .toString(\"ISO-8859-1\")");
49             System.out.println(uRI.toString("ISO-8859-1"));
50             actualReturn = URICodec.decode(uRI.toString("ISO-8859-1"), "ISO-8859-1");
51             assertEquals("return value", expectedReturn, actualReturn);
52         } catch (UnsupportedEncodingException JavaDoc uee) {
53             uee.printStackTrace();
54         }
55         uri = null;
56         uRI = new URI(uri);
57     }
58
59     public void testGetAuthority() {
60         String JavaDoc expectedReturn = null;
61         String JavaDoc actualReturn = uRI.getAuthority();
62         assertEquals("return value", expectedReturn, actualReturn);
63         /**@todo fill in the test code*/
64     }
65
66     public void testGetFragmentString() {
67         String JavaDoc expectedReturn = null;
68         String JavaDoc actualReturn = uRI.getFragmentString();
69         assertEquals("return value", expectedReturn, actualReturn);
70         /**@todo fill in the test code*/
71     }
72
73     public void testGetHostName() {
74         String JavaDoc expectedReturn = null;
75         String JavaDoc actualReturn = uRI.getHostName();
76         assertEquals("return value", expectedReturn, actualReturn);
77         /**@todo fill in the test code*/
78     }
79
80     public void testGetPath() {
81         String JavaDoc expectedReturn = null;
82         String JavaDoc actualReturn = uRI.getPath();
83         assertEquals("return value", expectedReturn, actualReturn);
84         /**@todo fill in the test code*/
85     }
86
87     public void testGetPort() {
88         int expectedReturn = -1;
89         int actualReturn = uRI.getPort();
90         assertEquals("return value", expectedReturn, actualReturn);
91         /**@todo fill in the test code*/
92     }
93
94     public void testGetQueryString() {
95         String JavaDoc expectedReturn = null;
96         String JavaDoc actualReturn = uRI.getQueryString();
97         assertEquals("return value", expectedReturn, actualReturn);
98         /**@todo fill in the test code*/
99     }
100
101     public void testGetScheme() {
102         String JavaDoc expectedReturn = null;
103         String JavaDoc actualReturn = uRI.getScheme();
104         assertEquals("return value", expectedReturn, actualReturn);
105         /**@todo fill in the test code*/
106     }
107
108     public void testGetUserInfo() {
109         String JavaDoc expectedReturn = null;
110         String JavaDoc actualReturn = uRI.getUserInfo();
111         assertEquals("return value", expectedReturn, actualReturn);
112         /**@todo fill in the test code*/
113     }
114
115     public void testIsURIStartingAtPath() {
116         boolean expectedReturn = false;
117         boolean actualReturn = uRI.isURIStartingAtPath();
118         assertEquals("return value", expectedReturn, actualReturn);
119         /**@todo fill in the test code*/
120     }
121
122     public void testSetAuthority() {
123         String JavaDoc authority = null;
124         uRI.setAuthority(authority);
125         /**@todo fill in the test code*/
126     }
127
128     public void testSetFragmentString() {
129         String JavaDoc fragmentString = null;
130         uRI.setFragmentString(fragmentString);
131         /**@todo fill in the test code*/
132     }
133
134     public void testSetHostName() {
135         String JavaDoc hostName = null;
136         uRI.setHostName(hostName);
137         /**@todo fill in the test code*/
138     }
139
140     public void testSetPath() {
141         String JavaDoc path = null;
142         uRI.setPath(path);
143         /**@todo fill in the test code*/
144     }
145
146     public void testSetPort() {
147         int port = 0;
148         uRI.setPort(port);
149         /**@todo fill in the test code*/
150     }
151
152     public void testSetQueryString() {
153         String JavaDoc queryString = null;
154         uRI.setQueryString(queryString);
155         /**@todo fill in the test code*/
156     }
157
158     public void testSetScheme() {
159         String JavaDoc scheme = null;
160         uRI.setScheme(scheme);
161         /**@todo fill in the test code*/
162     }
163
164     public void testSetURI() {
165         String JavaDoc uri = null;
166         uRI.setURI(uri);
167         /**@todo fill in the test code*/
168     }
169
170     public void testSetURI1() {
171         URL javaURL = null;
172         uRI.setURI(javaURL);
173         /**@todo fill in the test code*/
174     }
175
176     public void testSetURIStartingAtPath() {
177         boolean uriStartingAtPath = false;
178         uRI.setURIStartingAtPath(uriStartingAtPath);
179         /**@todo fill in the test code*/
180     }
181
182     public void testSetUserInfo() {
183         String JavaDoc userInfo = null;
184         uRI.setUserInfo(userInfo);
185         /**@todo fill in the test code*/
186     }
187
188     public void testToString() {
189         String JavaDoc expectedReturn = null;
190         String JavaDoc actualReturn = uRI.toString();
191         assertEquals("return value", expectedReturn, actualReturn);
192         /**@todo fill in the test code*/
193     }
194
195     public void testToString1() {
196         HttpServletResponse response = null;
197         String JavaDoc expectedReturn = null;
198         String JavaDoc actualReturn = uRI.toString(response);
199         assertEquals("return value", expectedReturn, actualReturn);
200         /**@todo fill in the test code*/
201     }
202
203     public void testToString2() {
204         HttpServletResponse response = null;
205         String JavaDoc encoding = null;
206         String JavaDoc expectedReturn = null;
207         String JavaDoc actualReturn = uRI.toString(response, encoding);
208         assertEquals("return value", expectedReturn, actualReturn);
209         /**@todo fill in the test code*/
210     }
211
212     public void testToString3() {
213         String JavaDoc encoding = null;
214         String JavaDoc expectedReturn = null;
215         String JavaDoc actualReturn = uRI.toString(encoding);
216         assertEquals("return value", expectedReturn, actualReturn);
217         /**@todo fill in the test code*/
218     }
219
220 }
221
Popular Tags