K
- the key type of the map to be tested.V
- the value type of the map to be tested.@GwtCompatible public abstract class AbstractMapTester<K,V> extends AbstractContainerTester<Map<K,V>,Map.Entry<K,V>>
This class is GWT compatible. TODO: see how much of this is actually needed once Map testers are written. (It was cloned from AbstractCollectionTester.)
AbstractContainerTester.ArrayWithDuplicate<E>
container, samples
Constructor and Description |
---|
AbstractMapTester() |
Modifier and Type | Method and Description |
---|---|
protected Collection<Map.Entry<K,V>> |
actualContents() |
protected Map.Entry<K,V>[] |
createArrayWithNullKey() |
protected Map.Entry<K,V>[] |
createArrayWithNullValue() |
protected MinimalCollection<Map.Entry<K,V>> |
createDisjointCollection() |
protected Map.Entry<K,V> |
entry(K key,
V value) |
protected void |
expectContents(Collection<Map.Entry<K,V>> expected)
Asserts that the collection under test contains exactly the given elements,
respecting cardinality but not order.
|
protected void |
expectMissing(Map.Entry<K,V>... entries) |
protected void |
expectMissingKeys(K... elements) |
protected void |
expectMissingValues(V... elements) |
protected void |
expectNullKeyMissingWhenNullKeysUnsupported(String message)
Equivalent to
expectMissingKeys
(null)
except that the call to contains(null) is permitted to throw a
NullPointerException . |
protected void |
expectNullValueMissingWhenNullValuesUnsupported(String message)
Equivalent to
expectMissingValues
(null)
except that the call to contains(null) is permitted to throw a
NullPointerException . |
protected void |
expectReplacement(Map.Entry<K,V> newEntry) |
protected V |
get(K key)
Wrapper for
Map.get(Object) that forces the caller to pass in a key
of the same type as the map. |
protected K |
getKeyForNullValue() |
protected Map<K,V> |
getMap() |
protected int |
getNumEntries() |
protected Collection<Map.Entry<K,V>> |
getSampleEntries() |
protected Collection<Map.Entry<K,V>> |
getSampleEntries(int howMany) |
protected V |
getValueForNullKey() |
protected void |
initMapWithNullKey() |
protected void |
initMapWithNullValue() |
protected void |
resetMap() |
protected void |
resetMap(Map.Entry<K,V>[] entries) |
void |
setUp() |
createArrayWithDuplicateElement, createOrderedArray, createSamplesArray, emptyCollection, expectAdded, expectAdded, expectAdded, expectContents, expectUnchanged, getNullLocation, getNumElements, getOrderedElements, getSampleElements, getSampleElements, resetContainer, resetContainer
getName, getSubjectGenerator, getTestMethodName, init, init, tearDown
countTestCases, createResult, run, run, runBare, runTest, setName, toString
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
public void setUp() throws Exception
protected Collection<Map.Entry<K,V>> actualContents()
actualContents
in class AbstractContainerTester<Map<K,V>,Map.Entry<K,V>>
expectContents(E...)
and its friends.protected void resetMap()
protected void expectMissingKeys(K... elements)
protected void expectMissingValues(V... elements)
protected Map.Entry<K,V>[] createArrayWithNullKey()
null
as the key of the
middle element.protected V getValueForNullKey()
protected K getKeyForNullValue()
protected Map.Entry<K,V>[] createArrayWithNullValue()
null
as the value of the
middle element.protected void initMapWithNullKey()
protected void initMapWithNullValue()
protected void expectNullKeyMissingWhenNullKeysUnsupported(String message)
expectMissingKeys
(null)
except that the call to contains(null)
is permitted to throw a
NullPointerException
.message
- message to use upon assertion failureprotected void expectNullValueMissingWhenNullValuesUnsupported(String message)
expectMissingValues
(null)
except that the call to contains(null)
is permitted to throw a
NullPointerException
.message
- message to use upon assertion failureprotected MinimalCollection<Map.Entry<K,V>> createDisjointCollection()
createDisjointCollection
in class AbstractContainerTester<Map<K,V>,Map.Entry<K,V>>
protected int getNumEntries()
protected Collection<Map.Entry<K,V>> getSampleEntries(int howMany)
protected Collection<Map.Entry<K,V>> getSampleEntries()
protected void expectMissing(Map.Entry<K,V>... entries)
expectMissing
in class AbstractContainerTester<Map<K,V>,Map.Entry<K,V>>
protected void expectContents(Collection<Map.Entry<K,V>> expected)
AbstractContainerTester
AbstractListTester
, a call to expectContents()
invokes this
version.expectContents
in class AbstractContainerTester<Map<K,V>,Map.Entry<K,V>>
expected
- expected value of AbstractContainerTester.container
protected V get(K key)
Map.get(Object)
that forces the caller to pass in a key
of the same type as the map. Besides being slightly shorter than code that
uses getMap()
, it also ensures that callers don't pass an
Map.Entry
by mistake.Copyright © 2010-2013. All Rights Reserved.