Class MapPutTester<K,V>
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
com.google.common.collect.testing.AbstractTester<OneSizeTestContainerGenerator<Map<K,V>, Map.Entry<K,V>>>
com.google.common.collect.testing.AbstractContainerTester<Map<K,V>, Map.Entry<K,V>>
com.google.common.collect.testing.AbstractMapTester<K,V>
com.google.common.collect.testing.testers.MapPutTester<K,V>
- All Implemented Interfaces:
junit.framework.Test
A generic JUnit test which tests
put operations on a map. Can't be invoked directly;
please see MapTestSuiteBuilder.- Author:
- Chris Povirk, Kevin Bourrillion
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractContainerTester
AbstractContainerTester.ArrayWithDuplicate<E>Modifier and TypeClassDescriptionstatic final classAbstractContainerTester.ArrayWithDuplicate<E extends @Nullable Object> -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MethodReturns theMethodinstance fortestPut_nullKeyUnsupported()so that tests ofTreeMapcan suppress it withFeatureSpecificTestSuiteBuilder.suppressing()until JDK-5045147 is fixed.voidsetUp()voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidMethods inherited from class AbstractMapTester
actualContents, createArrayWithNullKey, createArrayWithNullValue, createDisjointCollection, entry, expectContents, expectMissing, expectMissingKeys, expectMissingValues, expectNullKeyMissingWhenNullKeysUnsupported, expectNullValueMissingWhenNullValuesUnsupported, expectReplacement, get, getKeyForNullValue, getMap, getNumEntries, getSampleEntries, getSampleEntries, getValueForNullKey, initMapWithNullKey, initMapWithNullValue, k0, k1, k2, k3, k4, resetMap, resetMap, v0, v1, v2, v3, v4Modifier and TypeMethodDescriptionprotected Collection<Map.Entry<K, V>> protected MinimalCollection<Map.Entry<K, V>> protected voidexpectContents(Collection<Map.Entry<K, V>> expected) Asserts that the collection under test contains exactly the given elements, respecting cardinality but not order.protected voidexpectMissing(Map.Entry<K, V>... entries) protected voidexpectMissingKeys(K... elements) protected voidexpectMissingValues(V... elements) protected voidEquivalent toexpectMissingKeys(null)except that the call tocontains(null)is permitted to throw aNullPointerException.protected voidEquivalent toexpectMissingValues(null)except that the call tocontains(null)is permitted to throw aNullPointerException.protected final voidexpectReplacement(Map.Entry<K, V> newEntry) protected VWrapper forMap.get(Object)that forces the caller to pass in a key of the same type as the map.protected KgetMap()protected intprotected Collection<Map.Entry<K, V>> protected Collection<Map.Entry<K, V>> getSampleEntries(int howMany) protected Vprotected voidprotected voidprotected final Kk0()protected final Kk1()protected final Kk2()protected final Kk3()protected final Kk4()protected final voidresetMap()protected voidprotected final Vv0()protected final Vv1()protected final Vv2()protected final Vv3()protected final Vv4()Methods inherited from class AbstractContainerTester
createArrayWithDuplicateElement, createOrderedArray, createSamplesArray, e0, e1, e2, e3, e4, emptyCollection, expectAdded, expectAdded, expectAdded, expectContents, expectUnchanged, getNullLocation, getNumElements, getOrderedElements, getSampleElements, getSampleElements, resetContainer, resetContainerModifier and TypeMethodDescriptionprotected AbstractContainerTester.ArrayWithDuplicate<Map.Entry<K, V>> e0()e1()e2()e3()e4()protected MinimalCollection<Map.Entry<K, V>> protected final voidexpectAdded(int index, Map.Entry<K, V>... elements) protected final voidexpectAdded(int index, Collection<Map.Entry<K, V>> elements) protected final voidexpectAdded(Map.Entry<K, V>... elements) Asserts that the collection under test contains exactly the elements it was initialized with plus the given elements, according toAbstractContainerTester.expectContents(java.util.Collection).protected final voidexpectContents(Map.Entry<K, V>... elements) protected voidprotected intprotected intReturns the sample elements as ordered byTestContainerGenerator.order(List).protected Collection<Map.Entry<K, V>> protected Collection<Map.Entry<K, V>> getSampleElements(int howMany) Replaces the existing container under test with a new container created by the subject generator.resetContainer(Map<K, V> newValue) Replaces the existing container under test with a new container.Methods inherited from class AbstractTester
assertNull, getName, getSubjectGenerator, getTestMethodName, init, init, tearDownModifier and TypeMethodDescriptionstatic voidassertNull(String message, @Nullable Object object) Asserts that the given object is non-null, with a better failure message thanTestCase.assertNull(String, Object).getName()final StringReturns the name of the test method invoked by this test instance.final voidfinal voidinit(OneSizeTestContainerGenerator<Map<K, V>, Map.Entry<K, V>> subjectGenerator, String suiteName, @Nullable Runnable setUp, @Nullable Runnable tearDown) voidtearDown()Methods inherited from class junit.framework.TestCase
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, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, run, run, runBare, runTest, setName, toString
-
Constructor Details
-
MapPutTester
public MapPutTester()
-
-
Method Details
-
setUp
-
testPut_supportedPresent
public void testPut_supportedPresent() -
testPut_supportedNotPresent
public void testPut_supportedNotPresent() -
testPutAbsentConcurrentWithEntrySetIteration
public void testPutAbsentConcurrentWithEntrySetIteration() -
testPutAbsentConcurrentWithKeySetIteration
public void testPutAbsentConcurrentWithKeySetIteration() -
testPutAbsentConcurrentWithValueIteration
public void testPutAbsentConcurrentWithValueIteration() -
testPut_unsupportedNotPresent
public void testPut_unsupportedNotPresent() -
testPut_unsupportedPresentExistingValue
public void testPut_unsupportedPresentExistingValue() -
testPut_unsupportedPresentDifferentValue
public void testPut_unsupportedPresentDifferentValue() -
testPut_nullKeySupportedNotPresent
public void testPut_nullKeySupportedNotPresent() -
testPut_nullKeySupportedPresent
public void testPut_nullKeySupportedPresent() -
testPut_nullKeyUnsupported
public void testPut_nullKeyUnsupported() -
testPut_nullValueSupported
public void testPut_nullValueSupported() -
testPut_nullValueUnsupported
public void testPut_nullValueUnsupported() -
testPut_replaceWithNullValueSupported
public void testPut_replaceWithNullValueSupported() -
testPut_replaceWithNullValueUnsupported
public void testPut_replaceWithNullValueUnsupported() -
testPut_replaceNullValueWithNullSupported
public void testPut_replaceNullValueWithNullSupported() -
testPut_replaceNullValueWithNonNullSupported
public void testPut_replaceNullValueWithNonNullSupported() -
testPut_nullKeyAndValueSupported
public void testPut_nullKeyAndValueSupported() -
getPutNullKeyUnsupportedMethod
Returns theMethodinstance fortestPut_nullKeyUnsupported()so that tests ofTreeMapcan suppress it withFeatureSpecificTestSuiteBuilder.suppressing()until JDK-5045147 is fixed.
-