diff options
Diffstat (limited to 'tests/netx/unit/net')
-rw-r--r-- | tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java | 20 | ||||
-rw-r--r-- | tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java | 30 |
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()); + } +} |