Fix test compilation and execution errors. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1714107 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/6a3dbcdc Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/6a3dbcdc Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/6a3dbcdc Branch: refs/heads/COLLECTIONS_3_2_X Commit: 6a3dbcdcd73667646931bff57bc230d1d4c2a1a5 Parents: cfceeb4 Author: Thomas Neidhart <t...@apache.org> Authored: Thu Nov 12 19:35:51 2015 +0000 Committer: Thomas Neidhart <t...@apache.org> Committed: Thu Nov 12 19:35:51 2015 +0000 ---------------------------------------------------------------------- .../collections/TestExtendedProperties.java | 5 +++-- .../functors/AbstractTestSerialization.java | 6 +++--- .../functors/TestPrototypeFactory.java | 6 +++--- .../commons/collections/map/TestFlat3Map.java | 20 ++++++++++---------- 4 files changed, 19 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6a3dbcdc/src/test/org/apache/commons/collections/TestExtendedProperties.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/TestExtendedProperties.java b/src/test/org/apache/commons/collections/TestExtendedProperties.java index 1fd2195..5323e33 100644 --- a/src/test/org/apache/commons/collections/TestExtendedProperties.java +++ b/src/test/org/apache/commons/collections/TestExtendedProperties.java @@ -319,7 +319,9 @@ public class TestExtendedProperties extends TestCase { SecurityManager manager = new SecurityManager() { public void checkPropertyAccess(String key) { - throw new SecurityException(); + if ("file.separator".equals(key)) { + throw new SecurityException(); + } } public void checkPermission(Permission perm) { @@ -333,7 +335,6 @@ public class TestExtendedProperties extends TestCase { ExtendedProperties properties = new ExtendedProperties(); assertNotNull(properties); } catch (Exception ex) { - ex.printStackTrace(); fail("failed to instantiate ExtendedProperties"); } finally { System.setSecurityManager(null); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6a3dbcdc/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java b/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java index cb41dea..1c39b18 100644 --- a/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java +++ b/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java @@ -60,7 +60,7 @@ public abstract class AbstractTestSerialization extends BulkTest { //----------------------------------------------------------------------- public void testSerializationDisabled() throws Exception { - Assert.assertNull(System.getProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY)); + Assert.assertFalse("true".equalsIgnoreCase(System.getProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY))); Object object = makeObject(); try { serialize(object); @@ -82,7 +82,7 @@ public abstract class AbstractTestSerialization extends BulkTest { } public void testSerializationEnabled() throws Exception { - Assert.assertNull(System.getProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY)); + Assert.assertFalse("true".equalsIgnoreCase(System.getProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY))); System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "true"); try { @@ -96,7 +96,7 @@ public abstract class AbstractTestSerialization extends BulkTest { fail("de-serialization of " + getTestClass().getName() + " should be enabled"); } } finally { - System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY); + System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "false"); } } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6a3dbcdc/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java b/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java index 3701b04..1110d55 100644 --- a/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java +++ b/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java @@ -75,7 +75,7 @@ public class TestPrototypeFactory extends AbstractTestSerialization { Object dest = in.readObject(); in.close(); } finally { - System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY); + System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "false"); } } @@ -106,7 +106,7 @@ public class TestPrototypeFactory extends AbstractTestSerialization { Object dest = in.readObject(); in.close(); } finally { - System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY); + System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "false"); } } @@ -129,7 +129,7 @@ public class TestPrototypeFactory extends AbstractTestSerialization { Object dest = in.readObject(); in.close(); } finally { - System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY); + System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "false"); } } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6a3dbcdc/src/test/org/apache/commons/collections/map/TestFlat3Map.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/map/TestFlat3Map.java b/src/test/org/apache/commons/collections/map/TestFlat3Map.java index b48a867..39c9a3c 100644 --- a/src/test/org/apache/commons/collections/map/TestFlat3Map.java +++ b/src/test/org/apache/commons/collections/map/TestFlat3Map.java @@ -207,17 +207,17 @@ public class TestFlat3Map extends AbstractTestIterableMap { public void testCollections261() { final Flat3Map m = new Flat3Map(); - m.put( Integer.valueOf(1), Integer.valueOf(1) ); - m.put( Integer.valueOf(0), Integer.valueOf(0) ); - assertEquals( Integer.valueOf(1), m.remove( Integer.valueOf(1) ) ); - assertEquals( Integer.valueOf(0), m.remove( Integer.valueOf(0) ) ); + m.put( new Integer(1), new Integer(1) ); + m.put( new Integer(0), new Integer(0) ); + assertEquals( new Integer(1), m.remove( new Integer(1) ) ); + assertEquals( new Integer(0), m.remove( new Integer(0) ) ); - m.put( Integer.valueOf(2), Integer.valueOf(2) ); - m.put( Integer.valueOf(1), Integer.valueOf(1) ); - m.put( Integer.valueOf(0), Integer.valueOf(0) ); - assertEquals( Integer.valueOf(2), m.remove( Integer.valueOf(2) ) ); - assertEquals( Integer.valueOf(1), m.remove( Integer.valueOf(1) ) ); - assertEquals( Integer.valueOf(0), m.remove( Integer.valueOf(0) ) ); + m.put( new Integer(2), new Integer(2) ); + m.put( new Integer(1), new Integer(1) ); + m.put( new Integer(0), new Integer(0) ); + assertEquals( new Integer(2), m.remove( new Integer(2) ) ); + assertEquals( new Integer(1), m.remove( new Integer(1) ) ); + assertEquals( new Integer(0), m.remove( new Integer(0) ) ); } public void testSerialisation0() throws Exception {