This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git
The following commit(s) were added to refs/heads/master by this push: new bea1cc69 Remove Commons Collections Test Framework (#40) bea1cc69 is described below commit bea1cc69a7a5736b5479c0ec5d9248ad11f8e96c Author: Melloware <melloware...@gmail.com> AuthorDate: Wed Sep 13 17:34:15 2023 -0400 Remove Commons Collections Test Framework (#40) * Remove Commons Collections Test Framework * Update pom.xml * Delete src/test/java/org/apache/commons/beanutils2/collections/AbstractCollectionTest.java * Delete src/test/java/org/apache/commons/beanutils2/collections/AbstractMapTest.java * Delete src/test/java/org/apache/commons/beanutils2/collections/AbstractObjectTest.java * Delete src/test/java/org/apache/commons/beanutils2/collections/BulkTest.java * Delete src/test/java/org/apache/commons/beanutils2/collections/AbstractSetTest.java * Update BeanMapTestCase.java * Update BeanMapTestCase.java * Update pom.xml * Update pom.xml --- pom.xml | 13 ++- .../apache/commons/beanutils2/BeanMapTestCase.java | 122 +++++++++++++-------- 2 files changed, 87 insertions(+), 48 deletions(-) diff --git a/pom.xml b/pom.xml index b776056d..6a989dd6 100644 --- a/pom.xml +++ b/pom.xml @@ -342,9 +342,16 @@ <version>3.13.0</version> </dependency> <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections-testframework</artifactId> - <version>3.2.1</version> + <groupId>org.apache.commons</groupId> + <artifactId>commons-collections4</artifactId> + <version>4.4</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-collections4</artifactId> + <version>4.4</version> + <classifier>tests</classifier> <scope>test</scope> </dependency> <dependency> diff --git a/src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java b/src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java index f1561e3e..54d97ca4 100644 --- a/src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java +++ b/src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java @@ -22,8 +22,8 @@ import java.lang.reflect.Method; import java.util.Map; import org.apache.commons.beanutils2.bugs.other.Jira87BeanFactory; -import org.apache.commons.collections.BulkTest; -import org.apache.commons.collections.map.AbstractTestMap; +import org.apache.commons.collections4.map.AbstractMapTest; +import org.apache.commons.collections4.BulkTest; import junit.framework.Test; import junit.textui.TestRunner; @@ -33,7 +33,7 @@ import junit.textui.TestRunner; * */ @SuppressWarnings("deprecation") -public class BeanMapTestCase extends AbstractTestMap { +public class BeanMapTestCase extends AbstractMapTest<String, Object> { public static class BeanThrowingExceptions extends BeanWithProperties { private static final long serialVersionUID = 1L; @@ -174,13 +174,6 @@ public class BeanMapTestCase extends AbstractTestMap { super(testName); } - @Override - public Object[] getNewSampleValues() { - final Object[] values = { Integer.valueOf(223), Long.valueOf(23341928234L), Double.valueOf(23423.34), Float.valueOf(213332.12f), - Short.valueOf((short) 234), Byte.valueOf((byte) 20), Character.valueOf('b'), Integer.valueOf(232), "SomeNewStringValue", new Object(), null, }; - return values; - } - // note to self. The Sample keys were generated by copying the field // declarations and using the following regular expression search and replace: // @@ -192,9 +185,20 @@ public class BeanMapTestCase extends AbstractTestMap { // Then, I manually added the "class" key, which is a property that exists for // all beans (and all objects for that matter. @Override - public Object[] getSampleKeys() { - final Object[] keys = { "someIntValue", "someLongValue", "someDoubleValue", "someFloatValue", "someShortValue", "someByteValue", "someCharValue", - "someIntegerValue", "someStringValue", "someObjectValue", "class", }; + public String[] getSampleKeys() { + final String[] keys = new String[] { + "someIntValue", + "someLongValue", + "someDoubleValue", + "someFloatValue", + "someShortValue", + "someByteValue", + "someCharValue", + "someIntegerValue", + "someStringValue", + "someObjectValue", + "class", + }; return keys; } @@ -208,14 +212,21 @@ public class BeanMapTestCase extends AbstractTestMap { } @Override - public String[] ignoredTests() { - // Ignore the serialization tests on collection views. - return new String[] { "TestBeanMap.bulkTestMapEntrySet.testCanonicalEmptyCollectionExists", - "TestBeanMap.bulkTestMapEntrySet.testCanonicalFullCollectionExists", "TestBeanMap.bulkTestMapKeySet.testCanonicalEmptyCollectionExists", - "TestBeanMap.bulkTestMapKeySet.testCanonicalFullCollectionExists", "TestBeanMap.bulkTestMapValues.testCanonicalEmptyCollectionExists", - "TestBeanMap.bulkTestMapValues.testCanonicalFullCollectionExists", "TestBeanMap.bulkTestMapEntrySet.testSimpleSerialization", - "TestBeanMap.bulkTestMapKeySet.testSimpleSerialization", "TestBeanMap.bulkTestMapEntrySet.testSerializeDeserializeThenCompare", - "TestBeanMap.bulkTestMapKeySet.testSerializeDeserializeThenCompare" }; + public Object[] getNewSampleValues() { + final Object[] values = new Object[] { + Integer.valueOf(223), + Long.valueOf(23341928234L), + Double.valueOf(23423.34), + Float.valueOf(213332.12f), + Short.valueOf((short)234), + Byte.valueOf((byte)20), + Character.valueOf('b'), + Integer.valueOf(232), + "SomeNewStringValue", + new Object(), + null, + }; + return values; } /** @@ -236,11 +247,6 @@ public class BeanMapTestCase extends AbstractTestMap { return false; } - @Override - public Map<String, Object> makeEmptyMap() { - return new BeanMap(); - } - @Override public Map<String, Object> makeFullMap() { // note: These values must match (i.e. .equals() must return true) @@ -259,6 +265,46 @@ public class BeanMapTestCase extends AbstractTestMap { return new BeanMap(bean); } + @Override + public String[] ignoredTests() { + // Ignore the serialization tests on collection views. + return new String[] { + "TestBeanMap.bulkTestMapEntrySet.testCanonicalEmptyCollectionExists", + "TestBeanMap.bulkTestMapEntrySet.testCanonicalFullCollectionExists", + "TestBeanMap.bulkTestMapKeySet.testCanonicalEmptyCollectionExists", + "TestBeanMap.bulkTestMapKeySet.testCanonicalFullCollectionExists", + "TestBeanMap.bulkTestMapValues.testCanonicalEmptyCollectionExists", + "TestBeanMap.bulkTestMapValues.testCanonicalFullCollectionExists", + "TestBeanMap.bulkTestMapEntrySet.testSimpleSerialization", + "TestBeanMap.bulkTestMapKeySet.testSimpleSerialization", + "TestBeanMap.bulkTestMapEntrySet.testSerializeDeserializeThenCompare", + "TestBeanMap.bulkTestMapKeySet.testSerializeDeserializeThenCompare" + }; + } + + /** + * Need to override this method because the "clear()" method on the bean + * map just returns the bean properties to their default states. It does + * not actually remove the mappings as per the map contract. The default + * testClear() methods checks that the clear method throws an + * UnsupportedOperationException since this class is not add/remove + * modifiable. In our case though, we do not always throw that exception. + */ + @Override + public void testMapClear() { + //TODO: make sure a call to BeanMap.clear returns the bean to its + //default initialization values. + } + + /** + * Need to override this method because the "put()" method on the bean + * doesn't work for this type of Map. + */ + @Override + public void testMapPut() { + // see testBeanMapPutAllWriteable + } + public void testBeanMapClone() { final BeanMap map = (BeanMap) makeFullMap(); try { @@ -399,25 +445,6 @@ public class BeanMapTestCase extends AbstractTestMap { assertEquals("Double.TYPE", Double.valueOf("6"), beanMap.getTypeTransformer(Double.TYPE).apply("6")); } - /** - * Need to override this method because the "clear()" method on the bean map just returns the bean properties to their default states. It does not actually - * remove the mappings as per the map contract. The default testClear() methods checks that the clear method throws an UnsupportedOperationException since - * this class is not add/remove modifiable. In our case though, we do not always throw that exception. - */ - @Override - public void testMapClear() { - // TODO: make sure a call to BeanMap.clear returns the bean to its - // default initialization values. - } - - /** - * Need to override this method because the "put()" method on the bean doesn't work for this type of Map. - */ - @Override - public void testMapPut() { - // see testBeanMapPutAllWriteable - } - public void testMethodAccessor() throws Exception { final BeanMap map = (BeanMap) makeFullMap(); final Method method = BeanWithProperties.class.getDeclaredMethod("getSomeIntegerValue"); @@ -438,4 +465,9 @@ public class BeanMapTestCase extends AbstractTestMap { values = map.values(); super.verifyValues(); } + + @Override + public Map<String, Object> makeObject() { + return new BeanMap(); + } }