aboutsummaryrefslogtreecommitdiffstats
path: root/tests/netx/unit/net/sourceforge
diff options
context:
space:
mode:
authorAdam Domurad <[email protected]>2013-03-28 14:40:11 -0400
committerAdam Domurad <[email protected]>2013-03-28 14:40:11 -0400
commit30cfedc8f9d0fcaa0378005c9a0ca38930bf946b (patch)
tree374f8075602a274bab0c4deba711f9a67e277e94 /tests/netx/unit/net/sourceforge
parent6bc87a67d88072fa2d701cf4e6a700893ee81e00 (diff)
Move normalizeUrlAndStripParams to UrlUtils
Diffstat (limited to 'tests/netx/unit/net/sourceforge')
-rw-r--r--tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java20
-rw-r--r--tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java30
2 files changed, 30 insertions, 20 deletions
diff --git a/tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java b/tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java
index be33f20..31da5d3 100644
--- a/tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java
+++ b/tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java
@@ -36,24 +36,4 @@ public class UnsignedAppletTrustConfirmationTest {
assertEquals(toList("test .jar"),
UnsignedAppletTrustConfirmation.toRelativePaths(toList("http://example.com/test .jar"), "http://example.com/"));
}
-
- @Test
- public void testNormalizeUrlAndStripParams() throws Exception {
- /* Test that URL is normalized (encoded if not already encoded, leading whitespace trimmed, etc) */
- assertEquals("http://example.com/%20test%20test",
- UnsignedAppletTrustConfirmation.normalizeUrlAndStripParams(new URL("http://example.com/ test%20test ")).toString());
- /* Test that a URL without '?' is left unchanged */
- assertEquals("http://example.com/test",
- UnsignedAppletTrustConfirmation.normalizeUrlAndStripParams(new URL("http://example.com/test")).toString());
- /* Test that parts of a URL that come after '?' are stripped */
- assertEquals("http://example.com/test",
- UnsignedAppletTrustConfirmation.normalizeUrlAndStripParams(new URL("http://example.com/test?test=test")).toString());
- /* Test that everything after the first '?' is stripped */
- assertEquals("http://example.com/test",
- UnsignedAppletTrustConfirmation.normalizeUrlAndStripParams(new URL("http://example.com/test?http://example.com/?test")).toString());
-
- /* Test normalization + stripping */
- assertEquals("http://example.com/%20test%20test",
- UnsignedAppletTrustConfirmation.normalizeUrlAndStripParams(new URL("http://www.example.com/ test%20test ?test=test")).toString());
- }
} \ No newline at end of file
diff --git a/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java b/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java
new file mode 100644
index 0000000..bd0ef17
--- /dev/null
+++ b/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java
@@ -0,0 +1,30 @@
+package net.sourceforge.jnlp.util;
+
+import static org.junit.Assert.*;
+
+import java.net.URL;
+
+import org.junit.Test;
+
+public class UrlUtilsTest {
+
+ @Test
+ public void testNormalizeUrlAndStripParams() throws Exception {
+ /* Test that URL is normalized (encoded if not already encoded, leading whitespace trimmed, etc) */
+ assertEquals("http://example.com/%20test%20test",
+ UrlUtils.normalizeUrlAndStripParams(new URL("http://example.com/ test%20test ")).toString());
+ /* Test that a URL without '?' is left unchanged */
+ assertEquals("http://example.com/test",
+ UrlUtils.normalizeUrlAndStripParams(new URL("http://example.com/test")).toString());
+ /* Test that parts of a URL that come after '?' are stripped */
+ assertEquals("http://example.com/test",
+ UrlUtils.normalizeUrlAndStripParams(new URL("http://example.com/test?test=test")).toString());
+ /* Test that everything after the first '?' is stripped */
+ assertEquals("http://example.com/test",
+ UrlUtils.normalizeUrlAndStripParams(new URL("http://example.com/test?http://example.com/?test")).toString());
+
+ /* Test normalization + stripping */
+ assertEquals("http://example.com/%20test%20test",
+ UrlUtils.normalizeUrlAndStripParams(new URL("http://example.com/ test%20test ?test=test")).toString());
+ }
+}