Add missing @Override markers

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@966316 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-07-21 17:04:22 +00:00
parent c9e19ce6cd
commit 9601875f69
26 changed files with 175 additions and 0 deletions

View File

@ -134,42 +134,51 @@ public abstract class AbstractTestIterableMap<K, V> extends AbstractTestMap<K, V
super("InnerTestMapIterator");
}
@Override
public V[] addSetValues() {
return AbstractTestIterableMap.this.getNewSampleValues();
}
@Override
public boolean supportsRemove() {
return AbstractTestIterableMap.this.isRemoveSupported();
}
@Override
public boolean isGetStructuralModify() {
return AbstractTestIterableMap.this.isGetStructuralModify();
}
@Override
public boolean supportsSetValue() {
return AbstractTestIterableMap.this.isSetValueSupported();
}
@Override
public MapIterator<K, V> makeEmptyIterator() {
resetEmpty();
return AbstractTestIterableMap.this.getMap().mapIterator();
}
@Override
public MapIterator<K, V> makeObject() {
resetFull();
return AbstractTestIterableMap.this.getMap().mapIterator();
}
@Override
public Map<K, V> getMap() {
// assumes makeFullMapIterator() called first
return AbstractTestIterableMap.this.getMap();
}
@Override
public Map<K, V> getConfirmedMap() {
// assumes makeFullMapIterator() called first
return AbstractTestIterableMap.this.getConfirmed();
}
@Override
public void verify() {
super.verify();
AbstractTestIterableMap.this.verify();

View File

@ -422,6 +422,7 @@ public abstract class AbstractTestMap<K, V> extends AbstractTestObject {
*
* @return the map to be tested
*/
@Override
public abstract Map<K,V> makeObject();
/**
@ -460,6 +461,7 @@ public abstract class AbstractTestMap<K, V> 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<K, V> extends AbstractTestObject {
}
// Have to implement manually; entrySet doesn't support addAll
@Override
public Map.Entry<K, V>[] getOtherElements() {
K[] k = getOtherKeys();
V[] v = getOtherValues();
return makeEntryArray(k, v);
}
@Override
public Set<Map.Entry<K, V>> makeObject() {
return AbstractTestMap.this.makeObject().entrySet();
}
@Override
public Set<Map.Entry<K, V>> 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<K, V> 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<K, V> 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<K, V> extends AbstractTestObject {
super("");
}
@Override
public K[] getFullElements() {
return getSampleKeys();
}
@Override
public K[] getOtherElements() {
return getOtherKeys();
}
@Override
public Set<K> makeObject() {
return AbstractTestMap.this.makeObject().keySet();
}
@Override
public Set<K> 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<K, V> extends AbstractTestObject {
super("");
}
@Override
public V[] getFullElements() {
return getSampleValues();
}
@Override
public V[] getOtherElements() {
return getOtherValues();
}
@Override
public Collection<V> makeObject() {
return AbstractTestMap.this.makeObject().values();
}
@Override
public Collection<V> 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<V> makeConfirmedCollection() {
// never gets called, reset methods are overridden
return null;
}
@Override
public Collection<V> 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<K, V> extends AbstractTestObject {
/**
* Erases any leftover instance variables by setting them to null.
*/
@Override
public void tearDown() throws Exception {
map = null;
keySet = null;

View File

@ -50,6 +50,7 @@ public abstract class AbstractTestSortedMap<K, V> extends AbstractTestMap<K, V>
*
* @return false
*/
@Override
public boolean isAllowNullKey() {
return false;
}
@ -59,6 +60,7 @@ public abstract class AbstractTestSortedMap<K, V> extends AbstractTestMap<K, V>
*
* @return a map that is known to be valid
*/
@Override
public SortedMap<K, V> makeConfirmedMap() {
return new TreeMap<K, V>();
}
@ -120,59 +122,74 @@ public abstract class AbstractTestSortedMap<K, V> extends AbstractTestMap<K, V>
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<K, V> extends AbstractTestMap<K, V>
this.subSortedValues.subList(SUBSIZE, this.subSortedValues.size()).clear();
this.subSortedNewValues.addAll(Arrays.asList(main.getNewSampleValues()).subList(0, SUBSIZE));
}
@Override
public SortedMap<K, V> makeObject() {
// done this way so toKey is correctly set in the returned map
return ((SortedMap<K, V>) main.makeObject()).headMap(toKey);
}
@Override
public SortedMap<K, V> makeFullMap() {
return ((SortedMap<K, V>) main.makeFullMap()).headMap(toKey);
}
@ -227,6 +246,7 @@ public abstract class AbstractTestSortedMap<K, V> extends AbstractTestMap<K, V>
} catch (IllegalArgumentException ex) {}
verify();
}
@Override
public String getCompatibilityVersion() {
return main.getCompatibilityVersion() + ".HeadMapView";
}
@ -262,10 +282,12 @@ public abstract class AbstractTestSortedMap<K, V> extends AbstractTestMap<K, V>
this.subSortedValues.subList(0, this.subSortedValues.size() - SUBSIZE).clear();
this.subSortedNewValues.addAll(Arrays.asList(main.getNewSampleValues()).subList(0, SUBSIZE));
}
@Override
public SortedMap<K, V> makeObject() {
// done this way so toKey is correctly set in the returned map
return ((SortedMap<K, V>) main.makeObject()).tailMap(fromKey);
}
@Override
public SortedMap<K, V> makeFullMap() {
return ((SortedMap<K, V>) main.makeFullMap()).tailMap(fromKey);
}
@ -278,6 +300,7 @@ public abstract class AbstractTestSortedMap<K, V> extends AbstractTestMap<K, V>
} catch (IllegalArgumentException ex) {}
verify();
}
@Override
public String getCompatibilityVersion() {
return main.getCompatibilityVersion() + ".TailMapView";
}
@ -320,10 +343,12 @@ public abstract class AbstractTestSortedMap<K, V> extends AbstractTestMap<K, V>
SUBSIZE, this.main.getNewSampleValues().length - SUBSIZE));
}
@Override
public SortedMap<K, V> makeObject() {
// done this way so toKey is correctly set in the returned map
return ((SortedMap<K, V>) main.makeObject()).subMap(fromKey, toKey);
}
@Override
public SortedMap<K, V> makeFullMap() {
return ((SortedMap<K, V>) main.makeFullMap()).subMap(fromKey, toKey);
}
@ -336,6 +361,7 @@ public abstract class AbstractTestSortedMap<K, V> extends AbstractTestMap<K, V>
} catch (IllegalArgumentException ex) {}
verify();
}
@Override
public String getCompatibilityVersion() {
return main.getCompatibilityVersion() + ".SubMapView";
}

View File

@ -47,10 +47,12 @@ public class TestCaseInsensitiveMap<K, V> extends AbstractTestIterableMap<K, V>
return BulkTest.makeSuite(TestCaseInsensitiveMap.class);
}
@Override
public CaseInsensitiveMap<K, V> makeObject() {
return new CaseInsensitiveMap<K, V>();
}
@Override
public String getCompatibilityVersion() {
return "3";
}

View File

@ -45,6 +45,7 @@ public class TestCompositeMap<K, V> extends AbstractTestIterableMap<K, V> {
return new TestSuite(TestCompositeMap.class);
}
@Override
public void setUp() throws Exception {
super.setUp();
this.pass = false;
@ -55,6 +56,7 @@ public class TestCompositeMap<K, V> extends AbstractTestIterableMap<K, V> {
junit.textui.TestRunner.main(testCaseName);
}
@Override
public CompositeMap<K, V> makeObject() {
CompositeMap<K, V> map = new CompositeMap<K, V>();
map.addComposited(new HashMap<K, V>());
@ -215,6 +217,7 @@ public class TestCompositeMap<K, V> extends AbstractTestIterableMap<K, V> {
assertTrue(pass);
}
@Override
public String getCompatibilityVersion() {
return "3.3";
}

View File

@ -55,11 +55,13 @@ public class TestDefaultedMap<K, V> extends AbstractTestIterableMap<K, V> {
}
//-----------------------------------------------------------------------
@Override
public IterableMap<K, V> makeObject() {
return DefaultedMap.decorate(new HashMap<K, V>(), nullFactory);
}
//-----------------------------------------------------------------------
@Override
@SuppressWarnings("unchecked")
public void testMapGet() {
Map<K, V> map = new DefaultedMap<K, V>((V) "NULL");
@ -142,6 +144,7 @@ public class TestDefaultedMap<K, V> extends AbstractTestIterableMap<K, V> {
assertEquals("NULL_OBJECT", map.get(new Integer(0)));
}
@Override
public String getCompatibilityVersion() {
return "3.2";
}

View File

@ -48,24 +48,29 @@ public class TestFixedSizeMap<K, V> extends AbstractTestIterableMap<K, V> {
junit.textui.TestRunner.main(testCaseName);
}
@Override
public IterableMap<K, V> makeObject() {
return FixedSizeMap.decorate(new HashMap<K, V>());
}
@Override
public IterableMap<K, V> makeFullMap() {
Map<K, V> map = new HashMap<K, V>();
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";
}

View File

@ -48,30 +48,36 @@ public class TestFixedSizeSortedMap<K, V> extends AbstractTestSortedMap<K, V> {
}
//-----------------------------------------------------------------------
@Override
public SortedMap<K, V> makeObject() {
return FixedSizeSortedMap.decorate(new TreeMap<K, V>());
}
@Override
public SortedMap<K, V> makeFullMap() {
SortedMap<K, V> map = new TreeMap<K, V>();
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";
}

View File

@ -59,6 +59,7 @@ public class TestFlat3Map<K, V> extends AbstractTestIterableMap<K, V> {
return BulkTest.makeSuite(TestFlat3Map.class);
}
@Override
public Flat3Map<K, V> makeObject() {
return new Flat3Map<K, V>();
}
@ -344,6 +345,7 @@ public class TestFlat3Map<K, V> extends AbstractTestIterableMap<K, V> {
}
//-----------------------------------------------------------------------
@Override
public BulkTest bulkTestMapIterator() {
return new TestFlatMapIterator();
}
@ -353,44 +355,53 @@ public class TestFlat3Map<K, V> extends AbstractTestIterableMap<K, V> {
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<K, V> makeEmptyIterator() {
resetEmpty();
return TestFlat3Map.this.getMap().mapIterator();
}
@Override
public MapIterator<K, V> makeObject() {
resetFull();
return TestFlat3Map.this.getMap().mapIterator();
}
@Override
public IterableMap<K, V> getMap() {
// assumes makeFullMapIterator() called first
return TestFlat3Map.this.getMap();
}
@Override
public Map<K, V> 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";
}

View File

@ -42,10 +42,12 @@ public class TestHashedMap<K, V> extends AbstractTestIterableMap<K, V> {
return BulkTest.makeSuite(TestHashedMap.class);
}
@Override
public HashedMap<K, V> makeObject() {
return new HashedMap<K, V>();
}
@Override
public String getCompatibilityVersion() {
return "3";
}

View File

@ -53,6 +53,7 @@ public class TestTransformedSortedMap<K, V> extends AbstractTestSortedMap<K, V>
}
//-----------------------------------------------------------------------
@Override
@SuppressWarnings("unchecked")
public SortedMap<K, V> makeObject() {
return TransformedSortedMap.decorate(new TreeMap<K, V>(),
@ -60,6 +61,7 @@ public class TestTransformedSortedMap<K, V> extends AbstractTestSortedMap<K, V>
(Transformer<? super V, ? extends V>) TransformerUtils.nopTransformer());
}
@Override
public boolean isSubMapViewsSerializable() {
// TreeMap sub map views have a bug in deserialization.
return false;
@ -165,6 +167,7 @@ public class TestTransformedSortedMap<K, V> extends AbstractTestSortedMap<K, V>
}
//-----------------------------------------------------------------------
@Override
public String getCompatibilityVersion() {
return "3.1";
}

View File

@ -58,6 +58,7 @@ public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
/**
* Provides additional verifications for sets.
*/
@Override
public void verify() {
super.verify();
@ -75,6 +76,7 @@ public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
/**
* Set equals method is defined.
*/
@Override
public boolean isEqualsCheckable() {
return true;
}
@ -84,6 +86,7 @@ public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
*
* @return a confirmed empty collection
*/
@Override
public Collection<E> makeConfirmedCollection() {
return new HashSet<E>();
}
@ -93,6 +96,7 @@ public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
*
* @return a confirmed full collection
*/
@Override
public Collection<E> makeConfirmedFullCollection() {
Collection<E> set = makeConfirmedCollection();
set.addAll(Arrays.asList(getFullElements()));
@ -104,6 +108,7 @@ public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
*
* @return an empty set
*/
@Override
public abstract Set<E> makeObject();
/**
@ -114,6 +119,7 @@ public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
*
* @return a full set
*/
@Override
public Set<E> makeFullCollection() {
Set<E> set = makeObject();
set.addAll(Arrays.asList(getFullElements()));
@ -124,6 +130,7 @@ public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
/**
* Return the {@link AbstractTestCollection#collection} fixture, but cast as a Set.
*/
@Override
public Set<E> getCollection() {
return (Set<E>) super.getCollection();
}
@ -131,6 +138,7 @@ public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
/**
* Return the {@link AbstractTestCollection#confirmed} fixture, but cast as a Set.
*/
@Override
public Set<E> getConfirmed() {
return (Set<E>) super.getConfirmed();
}

View File

@ -52,6 +52,7 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
* 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<E> extends AbstractTestSet<E> {
* 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<E> extends AbstractTestSet<E> {
*
* @return a confirmed empty collection
*/
@Override
public SortedSet<E> makeConfirmedCollection() {
return new TreeSet<E>();
}
@ -117,6 +120,7 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
/**
* Override to return comparable objects.
*/
@Override
@SuppressWarnings("unchecked")
public E[] getFullNonNullElements() {
Object[] elements = new Object[30];
@ -130,6 +134,7 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
/**
* Override to return comparable objects.
*/
@Override
@SuppressWarnings("unchecked")
public E[] getOtherNonNullElements() {
Object[] elements = new Object[30];
@ -251,22 +256,28 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
}
@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<E> extends AbstractTestSet<E> {
}
}
@Override
public SortedSet<E> makeObject() {
return getSubSet(AbstractTestSortedSet.this.makeObject());
}
@Override
public SortedSet<E> 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
}

View File

@ -46,6 +46,7 @@ public class TestCompositeSet<E> extends AbstractTestSet<E> {
return new TestSuite(TestCompositeSet.class);
}
@Override
public CompositeSet<E> makeObject() {
final HashSet<E> contained = new HashSet<E>();
CompositeSet<E> set = new CompositeSet<E>(contained);
@ -163,6 +164,7 @@ public class TestCompositeSet<E> extends AbstractTestSet<E> {
}
}
@Override
public String getCompatibilityVersion() {
return "3.3";
}

View File

@ -55,6 +55,7 @@ public class TestListOrderedSet<E> extends AbstractTestSet<E> {
junit.textui.TestRunner.main(testCaseName);
}
@Override
public ListOrderedSet<E> makeObject() {
return ListOrderedSet.decorate(new HashSet<E>());
}
@ -186,18 +187,22 @@ public class TestListOrderedSet<E> extends AbstractTestSet<E> {
}
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<E> extends AbstractTestSet<E> {
} catch (IllegalArgumentException ex) {}
}
@Override
public String getCompatibilityVersion() {
return "3.1";
}

View File

@ -53,6 +53,7 @@ public class TestListOrderedSet2<E> extends AbstractTestSet<E> {
junit.textui.TestRunner.main(testCaseName);
}
@Override
public ListOrderedSet<E> makeObject() {
return new ListOrderedSet<E>();
}
@ -168,6 +169,7 @@ public class TestListOrderedSet2<E> extends AbstractTestSet<E> {
assertSame(ONE, set.get(3));
}
@Override
public String getCompatibilityVersion() {
return "3.1";
}

View File

@ -46,10 +46,12 @@ public class TestMapBackedSet<E> extends AbstractTestSet<E> {
junit.textui.TestRunner.main(testCaseName);
}
@Override
public Set<E> makeObject() {
return MapBackedSet.decorate(new HashedMap<E, Object>());
}
@Override
public String getCompatibilityVersion() {
return "3.1";
}

View File

@ -47,6 +47,7 @@ public class TestMapBackedSet2<E> extends AbstractTestSet<E> {
junit.textui.TestRunner.main(testCaseName);
}
@Override
public Set<E> makeObject() {
return MapBackedSet.decorate(new LinkedMap<E, Object>());
}
@ -94,9 +95,11 @@ public class TestMapBackedSet2<E> extends AbstractTestSet<E> {
}
}
@Override
public void testCanonicalEmptyCollectionExists() {
}
@Override
public void testCanonicalFullCollectionExists() {
}

View File

@ -57,10 +57,12 @@ public class TestPredicatedSet<E> extends AbstractTestSet<E> {
return (PredicatedSet<E>) PredicatedSet.decorate(set, predicate);
}
@Override
public PredicatedSet<E> makeObject() {
return decorateSet(new HashSet<E>(), 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<E> extends AbstractTestSet<E> {
!set.contains("four"));
}
@Override
public String getCompatibilityVersion() {
return "3.1";
}

View File

@ -57,10 +57,12 @@ public class TestPredicatedSortedSet<E> extends AbstractTestSortedSet<E> {
protected Predicate<E> truePredicate = TruePredicate.<E>truePredicate();
@Override
public SortedSet<E> makeObject() {
return PredicatedSortedSet.decorate(new TreeSet<E>(), truePredicate);
}
@Override
public SortedSet<E> makeFullCollection() {
TreeSet<E> set = new TreeSet<E>();
set.addAll(Arrays.asList(getFullElements()));
@ -124,6 +126,7 @@ public class TestPredicatedSortedSet<E> extends AbstractTestSortedSet<E> {
assertTrue("natural order, so comparator should be null", c == null);
}
@Override
public String getCompatibilityVersion() {
return "3.1";
}

View File

@ -48,10 +48,12 @@ public class TestSynchronizedSet<E> extends AbstractTestSet<E> {
}
//-------------------------------------------------------------------
@Override
public Set<E> makeObject() {
return SynchronizedSet.decorate(new HashSet<E>());
}
@Override
public String getCompatibilityVersion() {
return "3.1";
}

View File

@ -48,10 +48,12 @@ public class TestSynchronizedSortedSet<E> extends AbstractTestSortedSet<E> {
}
//-------------------------------------------------------------------
@Override
public SortedSet<E> makeObject() {
return SynchronizedSortedSet.decorate(new TreeSet<E>());
}
@Override
public String getCompatibilityVersion() {
return "3.1";
}

View File

@ -50,22 +50,26 @@ public class TestTransformedSet<E> extends AbstractTestSet<E> {
junit.textui.TestRunner.main(testCaseName);
}
@Override
public Set<E> makeConfirmedCollection() {
return new HashSet<E>();
}
@Override
public Set<E> makeConfirmedFullCollection() {
Set<E> set = new HashSet<E>();
set.addAll(Arrays.asList(getFullElements()));
return set;
}
@Override
@SuppressWarnings("unchecked")
public Set<E> makeObject() {
return TransformedSet.decorate(new HashSet<E>(),
(Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
}
@Override
@SuppressWarnings("unchecked")
public Set<E> makeFullCollection() {
Set<E> list = new HashSet<E>();
@ -109,6 +113,7 @@ public class TestTransformedSet<E> extends AbstractTestSet<E> {
assertEquals(true, set.remove(new Integer((String) els[0])));
}
@Override
public String getCompatibilityVersion() {
return "3.1";
}

View File

@ -52,11 +52,13 @@ public class TestTransformedSortedSet<E> extends AbstractTestSortedSet<E> {
}
//-----------------------------------------------------------------------
@Override
@SuppressWarnings("unchecked")
public SortedSet<E> makeObject() {
return TransformedSortedSet.decorate(new TreeSet<E>(), (Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
}
@Override
@SuppressWarnings("unchecked")
public SortedSet<E> makeFullCollection() {
SortedSet<E> set = new TreeSet<E>();
@ -95,6 +97,7 @@ public class TestTransformedSortedSet<E> extends AbstractTestSortedSet<E> {
assertEquals(true, set.remove(new Integer((String) els[0])));
}
@Override
public String getCompatibilityVersion() {
return "3.1";
}

View File

@ -49,24 +49,29 @@ public class TestUnmodifiableSet<E> extends AbstractTestSet<E> {
}
//-------------------------------------------------------------------
@Override
public Set<E> makeObject() {
return UnmodifiableSet.decorate(new HashSet<E>());
}
@Override
public Set<E> makeFullCollection() {
HashSet<E> set = new HashSet<E>();
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";
}

View File

@ -54,20 +54,24 @@ public class TestUnmodifiableSortedSet<E> extends AbstractTestSortedSet<E> {
}
//-------------------------------------------------------------------
@Override
public SortedSet<E> makeObject() {
return UnmodifiableSortedSet.decorate(new TreeSet<E>());
}
@Override
public UnmodifiableSortedSet<E> makeFullCollection() {
TreeSet<E> set = new TreeSet<E>();
set.addAll(Arrays.asList(getFullElements()));
return (UnmodifiableSortedSet<E>) UnmodifiableSortedSet.decorate(set);
}
@Override
public boolean isAddSupported() {
return false;
}
@Override
public boolean isRemoveSupported() {
return false;
}
@ -141,6 +145,7 @@ public class TestUnmodifiableSortedSet<E> extends AbstractTestSortedSet<E> {
assertTrue("natural order, so comparator should be null", c == null);
}
@Override
public String getCompatibilityVersion() {
return "3.1";
}