diff --git a/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java b/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java index 5213f93d3..174af7782 100644 --- a/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java +++ b/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java @@ -134,42 +134,51 @@ public abstract class AbstractTestIterableMap extends AbstractTestMap makeEmptyIterator() { resetEmpty(); return AbstractTestIterableMap.this.getMap().mapIterator(); } + @Override public MapIterator makeObject() { resetFull(); return AbstractTestIterableMap.this.getMap().mapIterator(); } + @Override public Map getMap() { // assumes makeFullMapIterator() called first return AbstractTestIterableMap.this.getMap(); } + @Override public Map getConfirmedMap() { // assumes makeFullMapIterator() called first return AbstractTestIterableMap.this.getConfirmed(); } + @Override public void verify() { super.verify(); AbstractTestIterableMap.this.verify(); diff --git a/src/test/org/apache/commons/collections/map/AbstractTestMap.java b/src/test/org/apache/commons/collections/map/AbstractTestMap.java index a308c12bb..c48d30ef9 100644 --- a/src/test/org/apache/commons/collections/map/AbstractTestMap.java +++ b/src/test/org/apache/commons/collections/map/AbstractTestMap.java @@ -422,6 +422,7 @@ public abstract class AbstractTestMap extends AbstractTestObject { * * @return the map to be tested */ + @Override public abstract Map makeObject(); /** @@ -460,6 +461,7 @@ public abstract class AbstractTestMap extends AbstractTestObject { /** * Gets the compatability version, needed for package access. */ + @Override public String getCompatibilityVersion() { return super.getCompatibilityVersion(); } @@ -1289,25 +1291,30 @@ public abstract class AbstractTestMap extends AbstractTestObject { } // Have to implement manually; entrySet doesn't support addAll + @Override public Map.Entry[] getOtherElements() { K[] k = getOtherKeys(); V[] v = getOtherValues(); return makeEntryArray(k, v); } + @Override public Set> makeObject() { return AbstractTestMap.this.makeObject().entrySet(); } + @Override public Set> makeFullCollection() { return makeFullMap().entrySet(); } + @Override public boolean isAddSupported() { // Collection views don't support add operations. return false; } + @Override public boolean isRemoveSupported() { // Entry set should only support remove if map does return AbstractTestMap.this.isRemoveSupported(); @@ -1317,16 +1324,19 @@ public abstract class AbstractTestMap extends AbstractTestObject { return AbstractTestMap.this.isGetStructuralModify(); } + @Override public boolean isTestSerialization() { return false; } + @Override public void resetFull() { AbstractTestMap.this.resetFull(); setCollection(AbstractTestMap.this.getMap().entrySet()); TestMapEntrySet.this.setConfirmed(AbstractTestMap.this.getConfirmed().entrySet()); } + @Override public void resetEmpty() { AbstractTestMap.this.resetEmpty(); setCollection(AbstractTestMap.this.getMap().entrySet()); @@ -1426,6 +1436,7 @@ public abstract class AbstractTestMap extends AbstractTestObject { assertEquals(false, getCollection().remove(new Object())); } + @Override public void verify() { super.verify(); AbstractTestMap.this.verify(); @@ -1450,50 +1461,61 @@ public abstract class AbstractTestMap extends AbstractTestObject { super(""); } + @Override public K[] getFullElements() { return getSampleKeys(); } + @Override public K[] getOtherElements() { return getOtherKeys(); } + @Override public Set makeObject() { return AbstractTestMap.this.makeObject().keySet(); } + @Override public Set makeFullCollection() { return AbstractTestMap.this.makeFullMap().keySet(); } + @Override public boolean isNullSupported() { return AbstractTestMap.this.isAllowNullKey(); } + @Override public boolean isAddSupported() { return false; } + @Override public boolean isRemoveSupported() { return AbstractTestMap.this.isRemoveSupported(); } + @Override public boolean isTestSerialization() { return false; } + @Override public void resetEmpty() { AbstractTestMap.this.resetEmpty(); setCollection(AbstractTestMap.this.getMap().keySet()); TestMapKeySet.this.setConfirmed(AbstractTestMap.this.getConfirmed().keySet()); } + @Override public void resetFull() { AbstractTestMap.this.resetFull(); setCollection(AbstractTestMap.this.getMap().keySet()); TestMapKeySet.this.setConfirmed(AbstractTestMap.this.getConfirmed().keySet()); } + @Override public void verify() { super.verify(); AbstractTestMap.this.verify(); @@ -1518,66 +1540,80 @@ public abstract class AbstractTestMap extends AbstractTestObject { super(""); } + @Override public V[] getFullElements() { return getSampleValues(); } + @Override public V[] getOtherElements() { return getOtherValues(); } + @Override public Collection makeObject() { return AbstractTestMap.this.makeObject().values(); } + @Override public Collection makeFullCollection() { return AbstractTestMap.this.makeFullMap().values(); } + @Override public boolean isNullSupported() { return AbstractTestMap.this.isAllowNullKey(); } + @Override public boolean isAddSupported() { return false; } + @Override public boolean isRemoveSupported() { return AbstractTestMap.this.isRemoveSupported(); } + @Override public boolean isTestSerialization() { return false; } + @Override public boolean areEqualElementsDistinguishable() { // equal values are associated with different keys, so they are // distinguishable. return true; } + @Override public Collection makeConfirmedCollection() { // never gets called, reset methods are overridden return null; } + @Override public Collection makeConfirmedFullCollection() { // never gets called, reset methods are overridden return null; } + @Override public void resetFull() { AbstractTestMap.this.resetFull(); setCollection(map.values()); TestMapValues.this.setConfirmed(AbstractTestMap.this.getConfirmed().values()); } + @Override public void resetEmpty() { AbstractTestMap.this.resetEmpty(); setCollection(map.values()); TestMapValues.this.setConfirmed(AbstractTestMap.this.getConfirmed().values()); } + @Override public void verify() { super.verify(); AbstractTestMap.this.verify(); @@ -1724,6 +1760,7 @@ public abstract class AbstractTestMap extends AbstractTestObject { /** * Erases any leftover instance variables by setting them to null. */ + @Override public void tearDown() throws Exception { map = null; keySet = null; diff --git a/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java b/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java index b56e37209..85532b36f 100644 --- a/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java +++ b/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java @@ -50,6 +50,7 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap * * @return false */ + @Override public boolean isAllowNullKey() { return false; } @@ -59,6 +60,7 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap * * @return a map that is known to be valid */ + @Override public SortedMap makeConfirmedMap() { return new TreeMap(); } @@ -120,59 +122,74 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap super(name); this.main = main; } + @Override public void resetEmpty() { // needed to init verify correctly main.resetEmpty(); super.resetEmpty(); } + @Override public void resetFull() { // needed to init verify correctly main.resetFull(); super.resetFull(); } + @Override public void verify() { // cross verify changes on view with changes on main map super.verify(); main.verify(); } + @Override public BulkTest bulkTestHeadMap() { return null; // block infinite recursion } + @Override public BulkTest bulkTestTailMap() { return null; // block infinite recursion } + @Override public BulkTest bulkTestSubMap() { return null; // block infinite recursion } + @Override @SuppressWarnings("unchecked") public K[] getSampleKeys() { return (K[]) subSortedKeys.toArray(); } + @Override @SuppressWarnings("unchecked") public V[] getSampleValues() { return (V[]) subSortedValues.toArray(); } + @Override @SuppressWarnings("unchecked") public V[] getNewSampleValues() { return (V[]) subSortedNewValues.toArray(); } + @Override public boolean isAllowNullKey() { return main.isAllowNullKey(); } + @Override public boolean isAllowNullValue() { return main.isAllowNullValue(); } + @Override public boolean isPutAddSupported() { return main.isPutAddSupported(); } + @Override public boolean isPutChangeSupported() { return main.isPutChangeSupported(); } + @Override public boolean isRemoveSupported() { return main.isRemoveSupported(); } + @Override public boolean isTestSerialization() { return false; } @@ -211,10 +228,12 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap this.subSortedValues.subList(SUBSIZE, this.subSortedValues.size()).clear(); this.subSortedNewValues.addAll(Arrays.asList(main.getNewSampleValues()).subList(0, SUBSIZE)); } + @Override public SortedMap makeObject() { // done this way so toKey is correctly set in the returned map return ((SortedMap) main.makeObject()).headMap(toKey); } + @Override public SortedMap makeFullMap() { return ((SortedMap) main.makeFullMap()).headMap(toKey); } @@ -227,6 +246,7 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap } catch (IllegalArgumentException ex) {} verify(); } + @Override public String getCompatibilityVersion() { return main.getCompatibilityVersion() + ".HeadMapView"; } @@ -262,10 +282,12 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap this.subSortedValues.subList(0, this.subSortedValues.size() - SUBSIZE).clear(); this.subSortedNewValues.addAll(Arrays.asList(main.getNewSampleValues()).subList(0, SUBSIZE)); } + @Override public SortedMap makeObject() { // done this way so toKey is correctly set in the returned map return ((SortedMap) main.makeObject()).tailMap(fromKey); } + @Override public SortedMap makeFullMap() { return ((SortedMap) main.makeFullMap()).tailMap(fromKey); } @@ -278,6 +300,7 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap } catch (IllegalArgumentException ex) {} verify(); } + @Override public String getCompatibilityVersion() { return main.getCompatibilityVersion() + ".TailMapView"; } @@ -320,10 +343,12 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap SUBSIZE, this.main.getNewSampleValues().length - SUBSIZE)); } + @Override public SortedMap makeObject() { // done this way so toKey is correctly set in the returned map return ((SortedMap) main.makeObject()).subMap(fromKey, toKey); } + @Override public SortedMap makeFullMap() { return ((SortedMap) main.makeFullMap()).subMap(fromKey, toKey); } @@ -336,6 +361,7 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap } catch (IllegalArgumentException ex) {} verify(); } + @Override public String getCompatibilityVersion() { return main.getCompatibilityVersion() + ".SubMapView"; } diff --git a/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java b/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java index 2670063e3..445ea8737 100644 --- a/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java +++ b/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java @@ -47,10 +47,12 @@ public class TestCaseInsensitiveMap extends AbstractTestIterableMap return BulkTest.makeSuite(TestCaseInsensitiveMap.class); } + @Override public CaseInsensitiveMap makeObject() { return new CaseInsensitiveMap(); } + @Override public String getCompatibilityVersion() { return "3"; } diff --git a/src/test/org/apache/commons/collections/map/TestCompositeMap.java b/src/test/org/apache/commons/collections/map/TestCompositeMap.java index 76d3416db..6bd78250c 100644 --- a/src/test/org/apache/commons/collections/map/TestCompositeMap.java +++ b/src/test/org/apache/commons/collections/map/TestCompositeMap.java @@ -45,6 +45,7 @@ public class TestCompositeMap extends AbstractTestIterableMap { return new TestSuite(TestCompositeMap.class); } + @Override public void setUp() throws Exception { super.setUp(); this.pass = false; @@ -55,6 +56,7 @@ public class TestCompositeMap extends AbstractTestIterableMap { junit.textui.TestRunner.main(testCaseName); } + @Override public CompositeMap makeObject() { CompositeMap map = new CompositeMap(); map.addComposited(new HashMap()); @@ -215,6 +217,7 @@ public class TestCompositeMap extends AbstractTestIterableMap { assertTrue(pass); } + @Override public String getCompatibilityVersion() { return "3.3"; } diff --git a/src/test/org/apache/commons/collections/map/TestDefaultedMap.java b/src/test/org/apache/commons/collections/map/TestDefaultedMap.java index f5d480fab..52eef84df 100644 --- a/src/test/org/apache/commons/collections/map/TestDefaultedMap.java +++ b/src/test/org/apache/commons/collections/map/TestDefaultedMap.java @@ -55,11 +55,13 @@ public class TestDefaultedMap extends AbstractTestIterableMap { } //----------------------------------------------------------------------- + @Override public IterableMap makeObject() { return DefaultedMap.decorate(new HashMap(), nullFactory); } //----------------------------------------------------------------------- + @Override @SuppressWarnings("unchecked") public void testMapGet() { Map map = new DefaultedMap((V) "NULL"); @@ -142,6 +144,7 @@ public class TestDefaultedMap extends AbstractTestIterableMap { assertEquals("NULL_OBJECT", map.get(new Integer(0))); } + @Override public String getCompatibilityVersion() { return "3.2"; } diff --git a/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java b/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java index 8ffb22c4d..5abab2bdd 100644 --- a/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java +++ b/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java @@ -48,24 +48,29 @@ public class TestFixedSizeMap extends AbstractTestIterableMap { junit.textui.TestRunner.main(testCaseName); } + @Override public IterableMap makeObject() { return FixedSizeMap.decorate(new HashMap()); } + @Override public IterableMap makeFullMap() { Map map = new HashMap(); addSampleMappings(map); return FixedSizeMap.decorate(map); } + @Override public boolean isPutAddSupported() { return false; } + @Override public boolean isRemoveSupported() { return false; } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java b/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java index 5eaffce98..cbe45203d 100644 --- a/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java +++ b/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java @@ -48,30 +48,36 @@ public class TestFixedSizeSortedMap extends AbstractTestSortedMap { } //----------------------------------------------------------------------- + @Override public SortedMap makeObject() { return FixedSizeSortedMap.decorate(new TreeMap()); } + @Override public SortedMap makeFullMap() { SortedMap map = new TreeMap(); addSampleMappings(map); return FixedSizeSortedMap.decorate(map); } + @Override public boolean isSubMapViewsSerializable() { // TreeMap sub map views have a bug in deserialization. return false; } + @Override public boolean isPutAddSupported() { return false; } + @Override public boolean isRemoveSupported() { return false; } //----------------------------------------------------------------------- + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/map/TestFlat3Map.java b/src/test/org/apache/commons/collections/map/TestFlat3Map.java index 7ff3d47a6..91b7b632a 100644 --- a/src/test/org/apache/commons/collections/map/TestFlat3Map.java +++ b/src/test/org/apache/commons/collections/map/TestFlat3Map.java @@ -59,6 +59,7 @@ public class TestFlat3Map extends AbstractTestIterableMap { return BulkTest.makeSuite(TestFlat3Map.class); } + @Override public Flat3Map makeObject() { return new Flat3Map(); } @@ -344,6 +345,7 @@ public class TestFlat3Map extends AbstractTestIterableMap { } //----------------------------------------------------------------------- + @Override public BulkTest bulkTestMapIterator() { return new TestFlatMapIterator(); } @@ -353,44 +355,53 @@ public class TestFlat3Map extends AbstractTestIterableMap { super("TestFlatMapIterator"); } + @Override public V[] addSetValues() { return TestFlat3Map.this.getNewSampleValues(); } + @Override public boolean supportsRemove() { return TestFlat3Map.this.isRemoveSupported(); } + @Override public boolean supportsSetValue() { return TestFlat3Map.this.isSetValueSupported(); } + @Override public MapIterator makeEmptyIterator() { resetEmpty(); return TestFlat3Map.this.getMap().mapIterator(); } + @Override public MapIterator makeObject() { resetFull(); return TestFlat3Map.this.getMap().mapIterator(); } + @Override public IterableMap getMap() { // assumes makeFullMapIterator() called first return TestFlat3Map.this.getMap(); } + @Override public Map getConfirmedMap() { // assumes makeFullMapIterator() called first return TestFlat3Map.this.getConfirmed(); } + @Override public void verify() { super.verify(); TestFlat3Map.this.verify(); } } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/map/TestHashedMap.java b/src/test/org/apache/commons/collections/map/TestHashedMap.java index f22220f21..9b9ea70d3 100644 --- a/src/test/org/apache/commons/collections/map/TestHashedMap.java +++ b/src/test/org/apache/commons/collections/map/TestHashedMap.java @@ -42,10 +42,12 @@ public class TestHashedMap extends AbstractTestIterableMap { return BulkTest.makeSuite(TestHashedMap.class); } + @Override public HashedMap makeObject() { return new HashedMap(); } + @Override public String getCompatibilityVersion() { return "3"; } diff --git a/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java b/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java index 0d5234853..84a3e9b2f 100644 --- a/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java +++ b/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java @@ -53,6 +53,7 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap } //----------------------------------------------------------------------- + @Override @SuppressWarnings("unchecked") public SortedMap makeObject() { return TransformedSortedMap.decorate(new TreeMap(), @@ -60,6 +61,7 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap (Transformer) TransformerUtils.nopTransformer()); } + @Override public boolean isSubMapViewsSerializable() { // TreeMap sub map views have a bug in deserialization. return false; @@ -165,6 +167,7 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap } //----------------------------------------------------------------------- + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/set/AbstractTestSet.java b/src/test/org/apache/commons/collections/set/AbstractTestSet.java index 136ac7a20..f920f68bc 100644 --- a/src/test/org/apache/commons/collections/set/AbstractTestSet.java +++ b/src/test/org/apache/commons/collections/set/AbstractTestSet.java @@ -58,6 +58,7 @@ public abstract class AbstractTestSet extends AbstractTestCollection { /** * Provides additional verifications for sets. */ + @Override public void verify() { super.verify(); @@ -75,6 +76,7 @@ public abstract class AbstractTestSet extends AbstractTestCollection { /** * Set equals method is defined. */ + @Override public boolean isEqualsCheckable() { return true; } @@ -84,6 +86,7 @@ public abstract class AbstractTestSet extends AbstractTestCollection { * * @return a confirmed empty collection */ + @Override public Collection makeConfirmedCollection() { return new HashSet(); } @@ -93,6 +96,7 @@ public abstract class AbstractTestSet extends AbstractTestCollection { * * @return a confirmed full collection */ + @Override public Collection makeConfirmedFullCollection() { Collection set = makeConfirmedCollection(); set.addAll(Arrays.asList(getFullElements())); @@ -104,6 +108,7 @@ public abstract class AbstractTestSet extends AbstractTestCollection { * * @return an empty set */ + @Override public abstract Set makeObject(); /** @@ -114,6 +119,7 @@ public abstract class AbstractTestSet extends AbstractTestCollection { * * @return a full set */ + @Override public Set makeFullCollection() { Set set = makeObject(); set.addAll(Arrays.asList(getFullElements())); @@ -124,6 +130,7 @@ public abstract class AbstractTestSet extends AbstractTestCollection { /** * Return the {@link AbstractTestCollection#collection} fixture, but cast as a Set. */ + @Override public Set getCollection() { return (Set) super.getCollection(); } @@ -131,6 +138,7 @@ public abstract class AbstractTestSet extends AbstractTestCollection { /** * Return the {@link AbstractTestCollection#confirmed} fixture, but cast as a Set. */ + @Override public Set getConfirmed() { return (Set) super.getConfirmed(); } diff --git a/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java b/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java index e1f31e161..607306b81 100644 --- a/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java +++ b/src/test/org/apache/commons/collections/set/AbstractTestSortedSet.java @@ -52,6 +52,7 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet { * Verification extension, will check the order of elements, * the sets should already be verified equal. */ + @Override public void verify() { super.verify(); @@ -83,6 +84,7 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet { * Overridden because SortedSets don't allow null elements (normally). * @return false */ + @Override public boolean isNullSupported() { return false; } @@ -107,6 +109,7 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet { * * @return a confirmed empty collection */ + @Override public SortedSet makeConfirmedCollection() { return new TreeSet(); } @@ -117,6 +120,7 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet { /** * Override to return comparable objects. */ + @Override @SuppressWarnings("unchecked") public E[] getFullNonNullElements() { Object[] elements = new Object[30]; @@ -130,6 +134,7 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet { /** * Override to return comparable objects. */ + @Override @SuppressWarnings("unchecked") public E[] getOtherNonNullElements() { Object[] elements = new Object[30]; @@ -251,22 +256,28 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet { } + @Override public boolean isNullSupported() { return AbstractTestSortedSet.this.isNullSupported(); } + @Override public boolean isAddSupported() { return AbstractTestSortedSet.this.isAddSupported(); } + @Override public boolean isRemoveSupported() { return AbstractTestSortedSet.this.isRemoveSupported(); } + @Override public boolean isFailFastSupported() { return AbstractTestSortedSet.this.isFailFastSupported(); } + @Override public E[] getFullElements() { return m_FullElements; } + @Override public E[] getOtherElements() { return m_OtherElements; } @@ -285,24 +296,30 @@ public abstract class AbstractTestSortedSet extends AbstractTestSet { } } + @Override public SortedSet makeObject() { return getSubSet(AbstractTestSortedSet.this.makeObject()); } + @Override public SortedSet makeFullCollection() { return getSubSet(AbstractTestSortedSet.this.makeFullCollection()); } + @Override public boolean isTestSerialization() { return false; } + @Override public BulkTest bulkTestSortedSetSubSet() { return null; // prevent infinite recursion } + @Override public BulkTest bulkTestSortedSetHeadSet() { return null; // prevent infinite recursion } + @Override public BulkTest bulkTestSortedSetTailSet() { return null; // prevent infinite recursion } diff --git a/src/test/org/apache/commons/collections/set/TestCompositeSet.java b/src/test/org/apache/commons/collections/set/TestCompositeSet.java index 3a791e896..0c1b03dbd 100644 --- a/src/test/org/apache/commons/collections/set/TestCompositeSet.java +++ b/src/test/org/apache/commons/collections/set/TestCompositeSet.java @@ -46,6 +46,7 @@ public class TestCompositeSet extends AbstractTestSet { return new TestSuite(TestCompositeSet.class); } + @Override public CompositeSet makeObject() { final HashSet contained = new HashSet(); CompositeSet set = new CompositeSet(contained); @@ -163,6 +164,7 @@ public class TestCompositeSet extends AbstractTestSet { } } + @Override public String getCompatibilityVersion() { return "3.3"; } diff --git a/src/test/org/apache/commons/collections/set/TestListOrderedSet.java b/src/test/org/apache/commons/collections/set/TestListOrderedSet.java index 53fa5ba5a..f09c12d98 100644 --- a/src/test/org/apache/commons/collections/set/TestListOrderedSet.java +++ b/src/test/org/apache/commons/collections/set/TestListOrderedSet.java @@ -55,6 +55,7 @@ public class TestListOrderedSet extends AbstractTestSet { junit.textui.TestRunner.main(testCaseName); } + @Override public ListOrderedSet makeObject() { return ListOrderedSet.decorate(new HashSet()); } @@ -186,18 +187,22 @@ public class TestListOrderedSet extends AbstractTestSet { } static class A { + @Override public boolean equals(Object obj) { return (obj instanceof A || obj instanceof B); } + @Override public int hashCode() { return 1; } } static class B { + @Override public boolean equals(Object obj) { return (obj instanceof A || obj instanceof B); } + @Override public int hashCode() { return 1; } @@ -226,6 +231,7 @@ public class TestListOrderedSet extends AbstractTestSet { } catch (IllegalArgumentException ex) {} } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java b/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java index fcee5a932..f900a4013 100644 --- a/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java +++ b/src/test/org/apache/commons/collections/set/TestListOrderedSet2.java @@ -53,6 +53,7 @@ public class TestListOrderedSet2 extends AbstractTestSet { junit.textui.TestRunner.main(testCaseName); } + @Override public ListOrderedSet makeObject() { return new ListOrderedSet(); } @@ -168,6 +169,7 @@ public class TestListOrderedSet2 extends AbstractTestSet { assertSame(ONE, set.get(3)); } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/set/TestMapBackedSet.java b/src/test/org/apache/commons/collections/set/TestMapBackedSet.java index 91b1890d5..f008e83ec 100644 --- a/src/test/org/apache/commons/collections/set/TestMapBackedSet.java +++ b/src/test/org/apache/commons/collections/set/TestMapBackedSet.java @@ -46,10 +46,12 @@ public class TestMapBackedSet extends AbstractTestSet { junit.textui.TestRunner.main(testCaseName); } + @Override public Set makeObject() { return MapBackedSet.decorate(new HashedMap()); } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java b/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java index b32f33878..7805a8da7 100644 --- a/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java +++ b/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java @@ -47,6 +47,7 @@ public class TestMapBackedSet2 extends AbstractTestSet { junit.textui.TestRunner.main(testCaseName); } + @Override public Set makeObject() { return MapBackedSet.decorate(new LinkedMap()); } @@ -94,9 +95,11 @@ public class TestMapBackedSet2 extends AbstractTestSet { } } + @Override public void testCanonicalEmptyCollectionExists() { } + @Override public void testCanonicalFullCollectionExists() { } diff --git a/src/test/org/apache/commons/collections/set/TestPredicatedSet.java b/src/test/org/apache/commons/collections/set/TestPredicatedSet.java index cd42e6306..6bf3f0b11 100644 --- a/src/test/org/apache/commons/collections/set/TestPredicatedSet.java +++ b/src/test/org/apache/commons/collections/set/TestPredicatedSet.java @@ -57,10 +57,12 @@ public class TestPredicatedSet extends AbstractTestSet { return (PredicatedSet) PredicatedSet.decorate(set, predicate); } + @Override public PredicatedSet makeObject() { return decorateSet(new HashSet(), truePredicate); } + @Override @SuppressWarnings("unchecked") public E[] getFullElements() { return (E[]) new Object[] {"1", "3", "5", "7", "2", "4", "6"}; @@ -122,6 +124,7 @@ public class TestPredicatedSet extends AbstractTestSet { !set.contains("four")); } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java b/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java index b225c29e1..74782c95b 100644 --- a/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java +++ b/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java @@ -57,10 +57,12 @@ public class TestPredicatedSortedSet extends AbstractTestSortedSet { protected Predicate truePredicate = TruePredicate.truePredicate(); + @Override public SortedSet makeObject() { return PredicatedSortedSet.decorate(new TreeSet(), truePredicate); } + @Override public SortedSet makeFullCollection() { TreeSet set = new TreeSet(); set.addAll(Arrays.asList(getFullElements())); @@ -124,6 +126,7 @@ public class TestPredicatedSortedSet extends AbstractTestSortedSet { assertTrue("natural order, so comparator should be null", c == null); } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java b/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java index 98dc26bd0..ef74c7fa9 100644 --- a/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java +++ b/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java @@ -48,10 +48,12 @@ public class TestSynchronizedSet extends AbstractTestSet { } //------------------------------------------------------------------- + @Override public Set makeObject() { return SynchronizedSet.decorate(new HashSet()); } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java b/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java index 282b0dd88..b4407990d 100644 --- a/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java +++ b/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java @@ -48,10 +48,12 @@ public class TestSynchronizedSortedSet extends AbstractTestSortedSet { } //------------------------------------------------------------------- + @Override public SortedSet makeObject() { return SynchronizedSortedSet.decorate(new TreeSet()); } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/set/TestTransformedSet.java b/src/test/org/apache/commons/collections/set/TestTransformedSet.java index 6b72f91c6..5d836bdfc 100644 --- a/src/test/org/apache/commons/collections/set/TestTransformedSet.java +++ b/src/test/org/apache/commons/collections/set/TestTransformedSet.java @@ -50,22 +50,26 @@ public class TestTransformedSet extends AbstractTestSet { junit.textui.TestRunner.main(testCaseName); } + @Override public Set makeConfirmedCollection() { return new HashSet(); } + @Override public Set makeConfirmedFullCollection() { Set set = new HashSet(); set.addAll(Arrays.asList(getFullElements())); return set; } + @Override @SuppressWarnings("unchecked") public Set makeObject() { return TransformedSet.decorate(new HashSet(), (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); } + @Override @SuppressWarnings("unchecked") public Set makeFullCollection() { Set list = new HashSet(); @@ -109,6 +113,7 @@ public class TestTransformedSet extends AbstractTestSet { assertEquals(true, set.remove(new Integer((String) els[0]))); } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java index e650476c5..4b4d91117 100644 --- a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java +++ b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java @@ -52,11 +52,13 @@ public class TestTransformedSortedSet extends AbstractTestSortedSet { } //----------------------------------------------------------------------- + @Override @SuppressWarnings("unchecked") public SortedSet makeObject() { return TransformedSortedSet.decorate(new TreeSet(), (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); } + @Override @SuppressWarnings("unchecked") public SortedSet makeFullCollection() { SortedSet set = new TreeSet(); @@ -95,6 +97,7 @@ public class TestTransformedSortedSet extends AbstractTestSortedSet { assertEquals(true, set.remove(new Integer((String) els[0]))); } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java b/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java index 3ab61855c..1a814909b 100644 --- a/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java +++ b/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java @@ -49,24 +49,29 @@ public class TestUnmodifiableSet extends AbstractTestSet { } //------------------------------------------------------------------- + @Override public Set makeObject() { return UnmodifiableSet.decorate(new HashSet()); } + @Override public Set makeFullCollection() { HashSet set = new HashSet(); set.addAll(Arrays.asList(getFullElements())); return UnmodifiableSet.decorate(set); } + @Override public boolean isAddSupported() { return false; } + @Override public boolean isRemoveSupported() { return false; } + @Override public String getCompatibilityVersion() { return "3.1"; } diff --git a/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java b/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java index 174d4f3a9..8b72e3c8c 100644 --- a/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java +++ b/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java @@ -54,20 +54,24 @@ public class TestUnmodifiableSortedSet extends AbstractTestSortedSet { } //------------------------------------------------------------------- + @Override public SortedSet makeObject() { return UnmodifiableSortedSet.decorate(new TreeSet()); } + @Override public UnmodifiableSortedSet makeFullCollection() { TreeSet set = new TreeSet(); set.addAll(Arrays.asList(getFullElements())); return (UnmodifiableSortedSet) UnmodifiableSortedSet.decorate(set); } + @Override public boolean isAddSupported() { return false; } + @Override public boolean isRemoveSupported() { return false; } @@ -141,6 +145,7 @@ public class TestUnmodifiableSortedSet extends AbstractTestSortedSet { assertTrue("natural order, so comparator should be null", c == null); } + @Override public String getCompatibilityVersion() { return "3.1"; }