diff options
author | Omair Majid <[email protected]> | 2013-09-16 12:35:20 -0400 |
---|---|---|
committer | Omair Majid <[email protected]> | 2013-09-16 12:35:20 -0400 |
commit | 926b611a6b8908854a58561fc0690bbd77019d14 (patch) | |
tree | 68086deddd339a574cf805c1b8461aab0f2a714e | |
parent | a89c00457e5c694df860b00b8c89fd1b705a6604 (diff) |
Use Arrays.asList instead of custom implementation
2013-09-16 Omair Majid <[email protected]>
* tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java
(toList): Remove.
(checkForMainFileLeakTest): Use Arrays.asList.
* tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java
(toList): Remove.
(testToRelativePaths): Use Arrays.asList.
3 files changed, 21 insertions, 26 deletions
@@ -1,3 +1,12 @@ +2013-09-16 Omair Majid <[email protected]> + + * tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java + (toList): Remove. + (checkForMainFileLeakTest): Use Arrays.asList. + * tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java + (toList): Remove. + (testToRelativePaths): Use Arrays.asList. + 2013-09-16 Jiri Vanek <[email protected]> * Makefile.am: returned modified (EXTRA_DIST) variable. It is enriched for diff --git a/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java b/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java index 169af7b..c3ff3a7 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java @@ -43,6 +43,7 @@ import static org.junit.Assert.fail; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.jar.Attributes; import java.util.jar.Manifest; @@ -131,14 +132,6 @@ public class JNLPClassLoaderTest { } } - static private <T> List<T> toList(T ... parts) { - List<T> list = new ArrayList<T>(); - for (T part : parts) { - list.add(part); - } - return list; - } - /* Note: Although it does a basic check, this mainly checks for file-descriptor leak */ @Test public void checkForMainFileLeakTest() throws Exception { @@ -152,7 +145,7 @@ public class JNLPClassLoaderTest { @Override public void run() { try { - classLoader.checkForMain(toList(jnlpFile.jarDesc)); + classLoader.checkForMain(Arrays.asList(jnlpFile.jarDesc)); } catch (LaunchException e) { fail(e.toString()); } 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 31da5d3..0ec85de 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmationTest.java @@ -4,36 +4,29 @@ import static org.junit.Assert.assertEquals; import java.net.URL; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.junit.Test; public class UnsignedAppletTrustConfirmationTest { - private List<String> toList(String ... parts) { - List<String> list = new ArrayList<String>(); - for (String part : parts) { - list.add(part); - } - return list; - } - @Test public void testToRelativePaths() throws Exception { /* Absolute -> Relative */ - assertEquals(toList("test.jar"), - UnsignedAppletTrustConfirmation.toRelativePaths(toList("http://example.com/test.jar"), "http://example.com/")); + assertEquals(Arrays.asList("test.jar"), + UnsignedAppletTrustConfirmation.toRelativePaths(Arrays.asList("http://example.com/test.jar"), "http://example.com/")); /* Relative is unchanged */ - assertEquals(toList("test.jar"), - UnsignedAppletTrustConfirmation.toRelativePaths(toList("test.jar"), "http://example.com/")); + assertEquals(Arrays.asList("test.jar"), + UnsignedAppletTrustConfirmation.toRelativePaths(Arrays.asList("test.jar"), "http://example.com/")); /* Different root URL is unchanged */ - assertEquals(toList("http://example2.com/test.jar"), - UnsignedAppletTrustConfirmation.toRelativePaths(toList("http://example2.com/test.jar"), "http://example.com/")); + assertEquals(Arrays.asList("http://example2.com/test.jar"), + UnsignedAppletTrustConfirmation.toRelativePaths(Arrays.asList("http://example2.com/test.jar"), "http://example.com/")); /* Path with invalid URL characters is handled */ - assertEquals(toList("test .jar"), - UnsignedAppletTrustConfirmation.toRelativePaths(toList("http://example.com/test .jar"), "http://example.com/")); + assertEquals(Arrays.asList("test .jar"), + UnsignedAppletTrustConfirmation.toRelativePaths(Arrays.asList("http://example.com/test .jar"), "http://example.com/")); } -}
\ No newline at end of file +} |