diff options
author | Jiri Vanek <[email protected]> | 2013-12-13 09:54:16 +0100 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2013-12-13 09:54:16 +0100 |
commit | 6256aac59275df0edd0feb4950272aa33573be9f (patch) | |
tree | adba1e61360cf9e18597a8736b8c50b5022605a0 /tests/netx/unit/net/sourceforge | |
parent | 26e9ef073e4ba4e625c8596113e9138ec85162e4 (diff) |
unittests warning cleanup: fixed typechecks, rawtypes, redundant casts...
ScreenFinder fixed to work partially also in headless mode.
After this clean up only "internal proprietary API and may be removed in a future release" warnings remain fro make check. Please keep itw in this way :)
Diffstat (limited to 'tests/netx/unit/net/sourceforge')
8 files changed, 46 insertions, 46 deletions
diff --git a/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java b/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java index 951f9bf..2474d2a 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java @@ -32,10 +32,10 @@ import java.util.HashMap; import java.util.Map; import java.util.Hashtable; import java.util.List; -import junit.framework.Assert; import net.sourceforge.jnlp.cache.UpdatePolicy; import net.sourceforge.jnlp.util.replacements.BASE64Encoder; +import org.junit.Assert; import org.junit.Test; diff --git a/tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java b/tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java index e30d521..9724a74 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/resources/MessagesPropertiesTest.java @@ -175,7 +175,7 @@ public class MessagesPropertiesTest { allLog("Checking for same items between " + resourceBundle1.getLocale() + " x " + resourceBundle2.getLocale() + " (should be " + resourceBundle1.getIdentifier() + " x " + resourceBundle2.getIdentifier() + ")"); int localErrors=0; while (keys1.hasMoreElements()) { - String key = (String) keys1.nextElement(); + String key = keys1.nextElement(); String val1 = getMissingResourceAsEmpty(resourceBundle1.getBundle(), key); String val2 = getMissingResourceAsEmpty(resourceBundle2.getBundle(), key); outLog("\""+val1+"\" x \""+val2); @@ -222,7 +222,7 @@ public class MessagesPropertiesTest { String id = secondary[i].getIdentifier(); allLog("Checking for missing strings in " + sec.getLocale() + " (should be " + id + ") compared with default"); while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); + String key = keys.nextElement(); String val1 = getMissingResourceAsEmpty(main.getBundle(), key); String val2 = getMissingResourceAsEmpty(sec, key); outLog("\""+val1+"\" x \""+val2); @@ -257,7 +257,7 @@ public class MessagesPropertiesTest { allLog("Checking for empty items in " + resourceBundle.getLocale() + " (should be " + id + ")"); int localErrors=0; while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); + String key = keys.nextElement(); String val = getMissingResourceAsEmpty(resourceBundle, key); outLog("\""+key+"\" = \""+val); if (val.trim().isEmpty()) { @@ -285,7 +285,7 @@ public class MessagesPropertiesTest { outLog("Checking for redundant keys in " + sec.getLocale() + " (should be " + id + ") compared with default"); errLog("Checking for redundant keys in " + sec.getLocale() + " (should be " + id + ") compared with default"); while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); + String key = keys.nextElement(); String val2 = getMissingResourceAsEmpty(main.getBundle(), key); String val1 = getMissingResourceAsEmpty(sec, key); outLog("\""+val1+"\" x \""+val2); diff --git a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java index 650fd32..85ef2bc 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashUtilsTest.java @@ -44,11 +44,11 @@ import org.junit.Test; public class ErrorSplashUtilsTest { - private void fakeEnvironment(Map original) throws Exception { + private void fakeEnvironment(Map<String,String> original) throws Exception { SplashUtilsTest.fakeEnvironment(original); } - private Map getEnvironment() throws Exception { + private Map<String,String> getEnvironment() throws Exception { return SplashUtilsTest.getEnvironment(); } @@ -64,8 +64,8 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen1() throws Exception { - Map fake1 = new HashMap(); - Map original = getEnvironment(); + Map<String,String> fake1 = new HashMap<String,String>(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -85,10 +85,10 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen2() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -107,10 +107,10 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen3() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -129,10 +129,10 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen4() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -151,10 +151,10 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen5() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -170,10 +170,10 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen6() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, "fgdthyfjtuk"); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -192,9 +192,9 @@ public class ErrorSplashUtilsTest { @Test public void testgetErrorSplashScreen7() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, "egtrutkyukl"); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); diff --git a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java index 4d783d7..26a38e8 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashUtilsTest.java @@ -59,10 +59,11 @@ public class SplashUtilsTest { Assert.assertEquals(SplashUtils.SplashReason.JAVAWS, p2.getSplashReason()); } + @SuppressWarnings("unchecked") public static Map<String, String> getEnvironment() throws Exception { - Class[] classes = Collections.class.getDeclaredClasses(); + Class<?>[] classes = Collections.class.getDeclaredClasses(); Map<String, String> env = System.getenv(); - for (Class cl : classes) { + for (Class<?> cl : classes) { if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) { Field field = cl.getDeclaredField("m"); field.setAccessible(true); @@ -74,10 +75,11 @@ public class SplashUtilsTest { return null; } + @SuppressWarnings("unchecked") public static void fakeEnvironment(Map<String, String> newenv) throws Exception { - Class[] classes = Collections.class.getDeclaredClasses(); + Class<?>[] classes = Collections.class.getDeclaredClasses(); Map<String, String> env = System.getenv(); - for (Class cl : classes) { + for (Class<?> cl : classes) { if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) { Field field = cl.getDeclaredField("m"); field.setAccessible(true); @@ -91,8 +93,8 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen1() throws Exception { - Map fake1 = new HashMap(); - Map original = getEnvironment(); + Map<String,String> fake1 = new HashMap<String,String>(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -112,10 +114,10 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen2() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -134,10 +136,10 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen3() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.DEFAULT); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -156,10 +158,10 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen4() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -178,10 +180,10 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen5() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.NONE); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, SplashUtils.NONE); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -197,10 +199,10 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen6() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, SplashUtils.DEFAULT); fake1.put(SplashUtils.ICEDTEA_WEB_PLUGIN_SPLASH, "fgdthyfjtuk"); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); @@ -219,9 +221,9 @@ public class SplashUtilsTest { @Test public void testGetSplashScreen7() throws Exception { - Map fake1 = new HashMap(); + Map<String,String> fake1 = new HashMap<String,String>(); fake1.put(SplashUtils.ICEDTEA_WEB_SPLASH, "egtrutkyukl"); - Map original = getEnvironment(); + Map<String,String> original = getEnvironment(); Assert.assertNotNull(original); try { fakeEnvironment(fake1); diff --git a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java index abce413..17ac1d1 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/DescriptionInfoItemTest.java @@ -36,8 +36,8 @@ obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package net.sourceforge.jnlp.splashscreen.parts; -import junit.framework.Assert; import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; import org.junit.Test; public class DescriptionInfoItemTest { diff --git a/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java b/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java index 587915f..a5aa021 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/util/UrlUtilsTest.java @@ -42,8 +42,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.File; -import java.net.MalformedURLException; -import java.net.URISyntaxException; import java.net.URL; import org.junit.Test; @@ -134,7 +132,7 @@ public class UrlUtilsTest { for (String testPath : testPaths) { File testFile = new File(testPath); - URL notEncodedUrl = testFile.toURL(); + URL notEncodedUrl = testFile.toURI().toURL(); URL encodedUrl = testFile.toURI().toURL(); assertEquals(testFile, UrlUtils.decodeUrlAsFile(notEncodedUrl)); assertEquals(testFile, UrlUtils.decodeUrlAsFile(encodedUrl)); diff --git a/tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java b/tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java index 8985085..0e115fd 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/util/XDesktopEntryTest.java @@ -84,7 +84,7 @@ public class XDesktopEntryTest { backupedEnv = null; } else { backupedEnv = env; - Map m = new HashMap(env); + Map<String,String> m = new HashMap<String,String>(env); m.put(HOME, System.getProperty("user.home")); fakeEnvironment(m); ServerAccess.logOutputReprint("Hacked environment"); @@ -102,7 +102,7 @@ public class XDesktopEntryTest { } } - private static void fakeEnvironment(Map m) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassNotFoundException { + private static void fakeEnvironment(Map<String,String> m) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ClassNotFoundException { Class<?> processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment"); Field env = processEnvironmentClass.getDeclaredField("theUnmodifiableEnvironment"); env.setAccessible(true); diff --git a/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java b/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java index 4771085..27ee230 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64EncoderTest.java @@ -108,7 +108,7 @@ public class BASE64EncoderTest { private static Object createInsatnce(String ofCalss) throws ClassNotFoundException, InstantiationException, IllegalAccessException { - Class classDefinition = Class.forName(ofCalss); + Class<?> classDefinition = Class.forName(ofCalss); return classDefinition.newInstance(); } |