Author: niallp Date: Fri Sep 10 13:04:44 2010 New Revision: 995779 URL: http://svn.apache.org/viewvc?rev=995779&view=rev Log: Remove duplicate isPre14JVM() methods
Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PropertyUtilsTestCase.java commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleBeanificationTestCase.java Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java?rev=995779&r1=995778&r2=995779&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java Fri Sep 10 13:04:44 2010 @@ -128,7 +128,7 @@ public class BeanificationTestCase exten public void testMemoryLeak2() throws Exception { // tests when the map used by beanutils has the right behaviour - if (isPre14JVM()) { + if (BeanUtilsTestCase.isPre14JVM()) { System.out.println("WARNING: CANNOT TEST MEMORY LEAK ON PRE1.4 JVM"); return; } @@ -176,7 +176,7 @@ public class BeanificationTestCase exten /** Tests whether classloaders and beans are released from memory */ public void testMemoryLeak() throws Exception { - if (isPre14JVM()) { + if (BeanUtilsTestCase.isPre14JVM()) { System.out.println("WARNING: CANNOT TEST MEMORY LEAK ON PRE1.4 JVM"); return; } @@ -458,21 +458,6 @@ public class BeanificationTestCase exten assertTrue("Unset works", !beanOne.equals(ccll.get())); } - private boolean isPre14JVM() { - // some pre 1.4 JVM have buggy WeakHashMap implementations - // this is used to test for those JVM - String version = System.getProperty("java.specification.version"); - StringTokenizer tokenizer = new StringTokenizer(version,"."); - if (tokenizer.nextToken().equals("1")) { - String minorVersion = tokenizer.nextToken(); - if (minorVersion.equals("0")) return true; - if (minorVersion.equals("1")) return true; - if (minorVersion.equals("2")) return true; - if (minorVersion.equals("3")) return true; - } - return false; - } - // ---- Auxillary classes class TestClassLoader extends ClassLoader { Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PropertyUtilsTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PropertyUtilsTestCase.java?rev=995779&r1=995778&r2=995779&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PropertyUtilsTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/PropertyUtilsTestCase.java Fri Sep 10 13:04:44 2010 @@ -27,7 +27,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.StringTokenizer; import org.apache.commons.beanutils.priv.PrivateBeanFactory; import org.apache.commons.beanutils.priv.PrivateDirect; @@ -4429,7 +4428,7 @@ public class PropertyUtilsTestCase exten * See BEANUTILS-266 for changes and reason for test */ public void testExceptionFromInvoke() throws Exception { - if (isPre14JVM()) { + if (BeanUtilsTestCase.isPre14JVM()) { return; } try { @@ -4445,20 +4444,4 @@ public class PropertyUtilsTestCase exten fail("Expected IllegalArgumentException, but threw " + t); } } - - /** - * Test for JDK 1.4 - */ - private boolean isPre14JVM() { - String version = System.getProperty("java.specification.version"); - StringTokenizer tokenizer = new StringTokenizer(version,"."); - if (tokenizer.nextToken().equals("1")) { - String minorVersion = tokenizer.nextToken(); - if (minorVersion.equals("0")) return true; - if (minorVersion.equals("1")) return true; - if (minorVersion.equals("2")) return true; - if (minorVersion.equals("3")) return true; - } - return false; - } } Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleBeanificationTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleBeanificationTestCase.java?rev=995779&r1=995778&r2=995779&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleBeanificationTestCase.java (original) +++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleBeanificationTestCase.java Fri Sep 10 13:04:44 2010 @@ -28,6 +28,7 @@ import junit.framework.TestSuite; import org.apache.commons.logging.LogFactory; +import org.apache.commons.beanutils.BeanUtilsTestCase; import org.apache.commons.beanutils.ContextClassLoaderLocal; import org.apache.commons.beanutils.PrimitiveBean; import org.apache.commons.beanutils.ConvertUtils; @@ -137,7 +138,7 @@ public class LocaleBeanificationTestCase public void testMemoryLeak2() throws Exception { // tests when the map used by beanutils has the right behaviour - if (isPre14JVM()) { + if (BeanUtilsTestCase.isPre14JVM()) { System.out.println("WARNING: CANNOT TEST MEMORY LEAK ON PRE1.4 JVM"); return; } @@ -185,7 +186,7 @@ public class LocaleBeanificationTestCase /** Tests whether classloaders and beans are released from memory */ public void testMemoryLeak() throws Exception { - if (isPre14JVM()) { + if (BeanUtilsTestCase.isPre14JVM()) { System.out.println("WARNING: CANNOT TEST MEMORY LEAK ON PRE1.4 JVM"); return; } @@ -510,21 +511,6 @@ public class LocaleBeanificationTestCase } } - private boolean isPre14JVM() { - // some pre 1.4 JVM have buggy WeakHashMap implementations - // this is used to test for those JVM - String version = System.getProperty("java.specification.version"); - StringTokenizer tokenizer = new StringTokenizer(version,"."); - if (tokenizer.nextToken().equals("1")) { - String minorVersion = tokenizer.nextToken(); - if (minorVersion.equals("0")) return true; - if (minorVersion.equals("1")) return true; - if (minorVersion.equals("2")) return true; - if (minorVersion.equals("3")) return true; - } - return false; - } - // ---- Auxillary classes class TestClassLoader extends ClassLoader {