joerg 2004/04/29 15:49:59
Modified: src/test/org/apache/cocoon/util/test NetUtilsTestCase.java
Log:
normalize() testcases to make it working the same way as
java.net.URI().normalize() in JDK 1.4
Revision Changes Path
1.9 +11 -7
cocoon-2.1/src/test/org/apache/cocoon/util/test/NetUtilsTestCase.java
Index: NetUtilsTestCase.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/test/org/apache/cocoon/util/test/NetUtilsTestCase.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NetUtilsTestCase.java 29 Apr 2004 20:10:04 -0000 1.8
+++ NetUtilsTestCase.java 29 Apr 2004 22:49:59 -0000 1.9
@@ -199,16 +199,18 @@
/**
- * A unit test for <code>NetUtils.normalize()</code>
- *
- * @exception Exception Description of Exception
- * @since
+ * A unit test for [EMAIL PROTECTED] NetUtils#normalize(String)}
*/
public void testNormalize() throws Exception {
Object[] test_values = {
new String[]{"", ""},
new String[]{"/", "/"},
- new String[]{"/../", "/"},
+ new String[]{"/../", "/../"},
+ new String[]{"/../../", "/../../"},
+ new String[]{"/../../foo", "/../../foo"},
+ new String[]{"/../../foo//./../bar", "/../../bar"},
+ new String[]{"//foo//bar", "//foo/bar"},
+ new String[]{"//foo//./bar", "//foo/bar"},
new String[]{"/foo/bar", "/foo/bar"},
new String[]{"/foo/bar/", "/foo/bar/"},
new String[]{"/foo/../bar", "/bar"},
@@ -216,12 +218,14 @@
new String[]{"bar", "bar"},
new String[]{"foo/../bar", "bar"},
new String[]{"foo/./bar", "foo/bar"},
- new String[]{"foo/bar1/bar2/bar3/../../..", "foo"},
+ new String[]{"foo/bar1/bar2/bar3/../../..", "foo/"},
};
for (int i = 0; i < test_values.length; i++) {
String tests[] = (String[]) test_values[i];
String test = tests[0];
String expected = tests[1];
+ // alternative for JDK 1.4
+ //String expected = new
java.net.URI(test).normalize().toString();
String result = NetUtils.normalize(test);
String message = "Test " + "'" + test + "'";