Renamed unit tests for bidimap and splitmap package.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1374062 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2012-08-16 21:07:45 +00:00
parent 340cf440b9
commit 578a598fa7
12 changed files with 80 additions and 109 deletions

View File

@ -31,18 +31,15 @@ import org.apache.commons.collections.map.AbstractTestIterableMap;
/**
* Abstract test class for {@link BidiMap} methods and contracts.
*
* @version $Revision$
*
* @author Matthew Hawthorne
* @author Stephen Colebourne
* @version $Id$
*/
public abstract class AbstractTestBidiMap<K, V> extends AbstractTestIterableMap<K, V> {
public abstract class AbstractBidiMapTest<K, V> extends AbstractTestIterableMap<K, V> {
public AbstractTestBidiMap(String testName) {
public AbstractBidiMapTest(String testName) {
super(testName);
}
public AbstractTestBidiMap() {
public AbstractBidiMapTest() {
super("Inverse");
}
@ -388,13 +385,13 @@ public abstract class AbstractTestBidiMap<K, V> extends AbstractTestIterableMap<
return; // simplest way of dealing with tricky situation
}
entryConfirmed2.setValue(newValue1);
AbstractTestBidiMap.this.getConfirmed().remove(key1);
AbstractBidiMapTest.this.getConfirmed().remove(key1);
assertEquals(newValue1, entry2.getValue());
assertEquals(true, AbstractTestBidiMap.this.getMap().containsKey(entry2.getKey()));
assertEquals(true, AbstractTestBidiMap.this.getMap().containsValue(newValue1));
assertEquals(newValue1, AbstractTestBidiMap.this.getMap().get(entry2.getKey()));
assertEquals(false, AbstractTestBidiMap.this.getMap().containsKey(key1));
assertEquals(false, AbstractTestBidiMap.this.getMap().containsValue(newValue2));
assertEquals(true, AbstractBidiMapTest.this.getMap().containsKey(entry2.getKey()));
assertEquals(true, AbstractBidiMapTest.this.getMap().containsValue(newValue1));
assertEquals(newValue1, AbstractBidiMapTest.this.getMap().get(entry2.getKey()));
assertEquals(false, AbstractBidiMapTest.this.getMap().containsKey(key1));
assertEquals(false, AbstractBidiMapTest.this.getMap().containsValue(newValue2));
TestBidiMapEntrySet.this.verify();
// check for ConcurrentModification
@ -409,10 +406,10 @@ public abstract class AbstractTestBidiMap<K, V> extends AbstractTestIterableMap<
return new TestInverseBidiMap(this);
}
public class TestInverseBidiMap extends AbstractTestBidiMap<V, K> {
final AbstractTestBidiMap<K, V> main;
public class TestInverseBidiMap extends AbstractBidiMapTest<V, K> {
final AbstractBidiMapTest<K, V> main;
public TestInverseBidiMap(AbstractTestBidiMap<K, V> main) {
public TestInverseBidiMap(AbstractBidiMapTest<K, V> main) {
super();
this.main = main;
}
@ -485,47 +482,47 @@ public abstract class AbstractTestBidiMap<K, V> extends AbstractTestIterableMap<
@Override
public V[] addSetValues() {
return AbstractTestBidiMap.this.getNewSampleValues();
return AbstractBidiMapTest.this.getNewSampleValues();
}
@Override
public boolean supportsRemove() {
return AbstractTestBidiMap.this.isRemoveSupported();
return AbstractBidiMapTest.this.isRemoveSupported();
}
@Override
public boolean supportsSetValue() {
return AbstractTestBidiMap.this.isSetValueSupported();
return AbstractBidiMapTest.this.isSetValueSupported();
}
@Override
public MapIterator<K, V> makeEmptyIterator() {
resetEmpty();
return AbstractTestBidiMap.this.getMap().mapIterator();
return AbstractBidiMapTest.this.getMap().mapIterator();
}
@Override
public MapIterator<K, V> makeObject() {
resetFull();
return AbstractTestBidiMap.this.getMap().mapIterator();
return AbstractBidiMapTest.this.getMap().mapIterator();
}
@Override
public BidiMap<K, V> getMap() {
// assumes makeFullMapIterator() called first
return AbstractTestBidiMap.this.getMap();
return AbstractBidiMapTest.this.getMap();
}
@Override
public Map<K, V> getConfirmedMap() {
// assumes makeFullMapIterator() called first
return AbstractTestBidiMap.this.getConfirmed();
return AbstractBidiMapTest.this.getConfirmed();
}
@Override
public void verify() {
super.verify();
AbstractTestBidiMap.this.verify();
AbstractBidiMapTest.this.verify();
}
}
@ -586,7 +583,7 @@ public abstract class AbstractTestBidiMap<K, V> extends AbstractTestIterableMap<
return; // simplest way of dealing with tricky situation
}
confirmed.put(key2, newValue1);
AbstractTestBidiMap.this.getConfirmed().remove(key1);
AbstractBidiMapTest.this.getConfirmed().remove(key1);
assertEquals(newValue1, it.getValue());
assertEquals(true, bidi.containsKey(it.getKey()));
assertEquals(true, bidi.containsValue(newValue1));

View File

@ -24,12 +24,12 @@ import org.apache.commons.collections.OrderedBidiMap;
/**
* Test class for AbstractOrderedBidiMapDecorator.
*
* @version $Revision$
* @version $Id$
*/
public class TestAbstractOrderedBidiMapDecorator<K, V>
extends AbstractTestOrderedBidiMap<K, V> {
public class AbstractOrderedBidiMapDecoratorTest<K, V>
extends AbstractOrderedBidiMapTest<K, V> {
public TestAbstractOrderedBidiMapDecorator(String testName) {
public AbstractOrderedBidiMapDecoratorTest(String testName) {
super(testName);
}

View File

@ -31,18 +31,15 @@ import org.apache.commons.collections.iterators.AbstractTestMapIterator;
/**
* Abstract test class for {@link OrderedBidiMap} methods and contracts.
*
* @version $Revision$
*
* @author Matthew Hawthorne
* @author Stephen Colebourne
* @version $Id$
*/
public abstract class AbstractTestOrderedBidiMap<K, V> extends AbstractTestBidiMap<K, V> {
public abstract class AbstractOrderedBidiMapTest<K, V> extends AbstractBidiMapTest<K, V> {
public AbstractTestOrderedBidiMap(String testName) {
public AbstractOrderedBidiMapTest(String testName) {
super(testName);
}
public AbstractTestOrderedBidiMap() {
public AbstractOrderedBidiMapTest() {
super();
}
@ -167,47 +164,47 @@ public abstract class AbstractTestOrderedBidiMap<K, V> extends AbstractTestBidiM
@Override
public V[] addSetValues() {
return AbstractTestOrderedBidiMap.this.getNewSampleValues();
return AbstractOrderedBidiMapTest.this.getNewSampleValues();
}
@Override
public boolean supportsRemove() {
return AbstractTestOrderedBidiMap.this.isRemoveSupported();
return AbstractOrderedBidiMapTest.this.isRemoveSupported();
}
@Override
public boolean supportsSetValue() {
return AbstractTestOrderedBidiMap.this.isSetValueSupported();
return AbstractOrderedBidiMapTest.this.isSetValueSupported();
}
@Override
public MapIterator<K, V> makeEmptyIterator() {
resetEmpty();
return AbstractTestOrderedBidiMap.this.getMap().mapIterator();
return AbstractOrderedBidiMapTest.this.getMap().mapIterator();
}
@Override
public MapIterator<K, V> makeObject() {
resetFull();
return AbstractTestOrderedBidiMap.this.getMap().mapIterator();
return AbstractOrderedBidiMapTest.this.getMap().mapIterator();
}
@Override
public Map<K, V> getMap() {
// assumes makeFullMapIterator() called first
return AbstractTestOrderedBidiMap.this.map;
return AbstractOrderedBidiMapTest.this.map;
}
@Override
public Map<K, V> getConfirmedMap() {
// assumes makeFullMapIterator() called first
return AbstractTestOrderedBidiMap.this.confirmed;
return AbstractOrderedBidiMapTest.this.confirmed;
}
@Override
public void verify() {
super.verify();
AbstractTestOrderedBidiMap.this.verify();
AbstractOrderedBidiMapTest.this.verify();
}
}

View File

@ -34,18 +34,15 @@ import org.apache.commons.collections.map.AbstractTestSortedMap;
/**
* Abstract test class for {@link SortedBidiMap} methods and contracts.
*
* @version $Revision$
*
* @author Matthew Hawthorne
* @author Stephen Colebourne
* @version $Id$
*/
public abstract class AbstractTestSortedBidiMap<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestOrderedBidiMap<K, V> {
public abstract class AbstractSortedBidiMapTest<K extends Comparable<K>, V extends Comparable<V>> extends AbstractOrderedBidiMapTest<K, V> {
protected List<K> sortedKeys;
protected List<V> sortedValues = new ArrayList<V>();
protected SortedSet<V> sortedNewValues = new TreeSet<V>();
public AbstractTestSortedBidiMap(String testName) {
public AbstractSortedBidiMapTest(String testName) {
super(testName);
sortedKeys = getAsList(getSampleKeys());
Collections.sort(sortedKeys);

View File

@ -22,18 +22,15 @@ import org.apache.commons.collections.BulkTest;
/**
* JUnit tests.
*
* @version $Revision$
*
* @author Matthew Hawthorne
* @author Stephen Colebourne
* @version $Id$
*/
public class TestDualHashBidiMap<K, V> extends AbstractTestBidiMap<K, V> {
public class DualHashBidiMapTest<K, V> extends AbstractBidiMapTest<K, V> {
public static Test suite() {
return BulkTest.makeSuite(TestDualHashBidiMap.class);
return BulkTest.makeSuite(DualHashBidiMapTest.class);
}
public TestDualHashBidiMap(String testName) {
public DualHashBidiMapTest(String testName) {
super(testName);
}
@ -50,7 +47,7 @@ public class TestDualHashBidiMap<K, V> extends AbstractTestBidiMap<K, V> {
*/
@Override
public String[] ignoredTests() {
return new String[] { "TestDualHashBidiMap.bulkTestInverseMap.bulkTestInverseMap" };
return new String[] { "DualHashBidiMapTest.bulkTestInverseMap.bulkTestInverseMap" };
}
// public void testCreate() throws Exception {

View File

@ -36,20 +36,16 @@ import org.apache.commons.collections.comparators.ReverseComparator;
/**
* JUnit tests.
*
* @version $Revision$
*
* @author Matthew Hawthorne
* @author Stephen Colebourne
* @author Jonas Van Poucke
* @version $Id$
*/
@SuppressWarnings("boxing")
public class TestDualTreeBidiMap2<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestSortedBidiMap<K, V> {
public class DualTreeBidiMap2Test<K extends Comparable<K>, V extends Comparable<V>> extends AbstractSortedBidiMapTest<K, V> {
public static Test suite() {
return BulkTest.makeSuite(TestDualTreeBidiMap2.class);
return BulkTest.makeSuite(DualTreeBidiMap2Test.class);
}
public TestDualTreeBidiMap2(String testName) {
public DualTreeBidiMap2Test(String testName) {
super(testName);
}
@ -156,7 +152,7 @@ public class TestDualTreeBidiMap2<K extends Comparable<K>, V extends Comparable<
*/
@Override
public String[] ignoredTests() {
return new String[] {"TestDualTreeBidiMap2.bulkTestInverseMap.bulkTestInverseMap"};
return new String[] {"DualTreeBidiMap2Test.bulkTestInverseMap.bulkTestInverseMap"};
}
// public void testCreate() throws Exception {

View File

@ -22,18 +22,15 @@ import org.apache.commons.collections.BulkTest;
/**
* JUnit tests.
*
* @version $Revision$
*
* @author Matthew Hawthorne
* @author Stephen Colebourne
* @version $Id$
*/
public class TestDualTreeBidiMap<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestSortedBidiMap<K, V> {
public class DualTreeBidiMapTest<K extends Comparable<K>, V extends Comparable<V>> extends AbstractSortedBidiMapTest<K, V> {
public static Test suite() {
return BulkTest.makeSuite(TestDualTreeBidiMap.class);
return BulkTest.makeSuite(DualTreeBidiMapTest.class);
}
public TestDualTreeBidiMap(String testName) {
public DualTreeBidiMapTest(String testName) {
super(testName);
}
@ -50,7 +47,7 @@ public class TestDualTreeBidiMap<K extends Comparable<K>, V extends Comparable<V
*/
@Override
public String[] ignoredTests() {
return new String[] {"TestDualTreeBidiMap.bulkTestInverseMap.bulkTestInverseMap"};
return new String[] {"DualTreeBidiMapTest.bulkTestInverseMap.bulkTestInverseMap"};
}
// public void testCreate() throws Exception {

View File

@ -25,17 +25,15 @@ import org.apache.commons.collections.BulkTest;
/**
* JUnit tests.
*
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class TestTreeBidiMap<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestOrderedBidiMap<K, V> {
public class TreeBidiMapTest<K extends Comparable<K>, V extends Comparable<V>> extends AbstractOrderedBidiMapTest<K, V> {
public static Test suite() {
return BulkTest.makeSuite(TestTreeBidiMap.class);
return BulkTest.makeSuite(TreeBidiMapTest.class);
}
public TestTreeBidiMap(String testName) {
public TreeBidiMapTest(String testName) {
super(testName);
}
@ -54,7 +52,7 @@ public class TestTreeBidiMap<K extends Comparable<K>, V extends Comparable<V>> e
*/
@Override
public String[] ignoredTests() {
return new String[] {"TestTreeBidiMap.bulkTestInverseMap.bulkTestInverseMap"};
return new String[] {"TreeBidiMapTest.bulkTestInverseMap.bulkTestInverseMap"};
}
@Override

View File

@ -26,17 +26,15 @@ import org.apache.commons.collections.BulkTest;
/**
* JUnit tests.
*
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class TestUnmodifiableBidiMap<K, V> extends AbstractTestBidiMap<K, V> {
public class UnmodifiableBidiMapTest<K, V> extends AbstractBidiMapTest<K, V> {
public static Test suite() {
return BulkTest.makeSuite(TestUnmodifiableBidiMap.class);
return BulkTest.makeSuite(UnmodifiableBidiMapTest.class);
}
public TestUnmodifiableBidiMap(String testName) {
public UnmodifiableBidiMapTest(String testName) {
super(testName);
}
@ -62,7 +60,7 @@ public class TestUnmodifiableBidiMap<K, V> extends AbstractTestBidiMap<K, V> {
*/
@Override
public String[] ignoredTests() {
return new String[] {"TestUnmodifiableBidiMap.bulkTestInverseMap.bulkTestInverseMap"};
return new String[] {"UnmodifiableBidiMapTest.bulkTestInverseMap.bulkTestInverseMap"};
}
@Override

View File

@ -27,17 +27,15 @@ import org.apache.commons.collections.OrderedBidiMap;
/**
* JUnit tests.
*
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class TestUnmodifiableOrderedBidiMap<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestOrderedBidiMap<K, V> {
public class UnmodifiableOrderedBidiMapTest<K extends Comparable<K>, V extends Comparable<V>> extends AbstractOrderedBidiMapTest<K, V> {
public static Test suite() {
return BulkTest.makeSuite(TestUnmodifiableOrderedBidiMap.class);
return BulkTest.makeSuite(UnmodifiableOrderedBidiMapTest.class);
}
public TestUnmodifiableOrderedBidiMap(String testName) {
public UnmodifiableOrderedBidiMapTest(String testName) {
super(testName);
}
@ -63,7 +61,7 @@ public class TestUnmodifiableOrderedBidiMap<K extends Comparable<K>, V extends C
*/
@Override
public String[] ignoredTests() {
return new String[] {"TestUnmodifiableOrderedBidiMap.bulkTestInverseMap.bulkTestInverseMap"};
return new String[] {"UnmodifiableOrderedBidiMapTest.bulkTestInverseMap.bulkTestInverseMap"};
}
@Override

View File

@ -26,17 +26,15 @@ import org.apache.commons.collections.SortedBidiMap;
/**
* JUnit tests.
*
* @version $Revision$
*
* @author Stephen Colebourne
* @version $Id$
*/
public class TestUnmodifiableSortedBidiMap<K extends Comparable<K>, V extends Comparable<V>> extends AbstractTestSortedBidiMap<K, V> {
public class UnmodifiableSortedBidiMapTest<K extends Comparable<K>, V extends Comparable<V>> extends AbstractSortedBidiMapTest<K, V> {
public static Test suite() {
return BulkTest.makeSuite(TestUnmodifiableSortedBidiMap.class);
return BulkTest.makeSuite(UnmodifiableSortedBidiMapTest.class);
}
public TestUnmodifiableSortedBidiMap(String testName) {
public UnmodifiableSortedBidiMapTest(String testName) {
super(testName);
}
@ -67,7 +65,7 @@ public class TestUnmodifiableSortedBidiMap<K extends Comparable<K>, V extends Co
@Override
public String[] ignoredTests() {
// Override to prevent infinite recursion of tests.
return new String[] {"TestUnmodifiableSortedBidiMap.bulkTestInverseMap.bulkTestInverseMap"};
return new String[] {"UnmodifiableSortedBidiMapTest.bulkTestInverseMap.bulkTestInverseMap"};
}
//-----------------------------------------------------------------------

View File

@ -28,15 +28,13 @@ import org.apache.commons.collections.functors.NOPTransformer;
/**
* Tests for {@link TransformedMap}
*
* @since Commons Collections 5
* TODO fix version, add Serialization tests
* @version $Revision$
*
* @author Stephen Colebourne
* @author Matt Benson
* @since 4.0
* @version $Id$
*/
@SuppressWarnings("boxing")
public class TestTransformedMap extends BulkTest {
public class TransformedMapTest extends BulkTest {
private Transformer<Integer, String> intToString = new Transformer<Integer, String>() {
public String transform(Integer input) {
@ -56,7 +54,7 @@ public class TestTransformedMap extends BulkTest {
}
};
public TestTransformedMap(String testName) {
public TransformedMapTest(String testName) {
super(testName);
}