com.google.common.collect.testing
Class ConcurrentMapInterfaceTest<K,V>

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.google.common.collect.testing.MapInterfaceTest<K,V>
              extended by com.google.common.collect.testing.ConcurrentMapInterfaceTest<K,V>
All Implemented Interfaces:
junit.framework.Test

@GwtCompatible
public abstract class ConcurrentMapInterfaceTest<K,V>
extends MapInterfaceTest<K,V>

Tests representing the contract of ConcurrentMap. Concrete subclasses of this base class test conformance of concrete ConcurrentMap subclasses to that contract.

This class is GWT compatible.

The tests in this class for null keys and values only check maps for which null keys and values are not allowed. There are currently no ConcurrentMap implementations that support nulls.

Author:
Jared Levy

Field Summary
 
Fields inherited from class com.google.common.collect.testing.MapInterfaceTest
allowsNullKeys, allowsNullValues, supportsClear, supportsIteratorRemove, supportsPut, supportsRemove
 
Constructor Summary
protected ConcurrentMapInterfaceTest(boolean allowsNullKeys, boolean allowsNullValues, boolean supportsPut, boolean supportsRemove, boolean supportsClear)
           
 
Method Summary
protected abstract  V getSecondValueNotInPopulatedMap()
          Creates a new value that is not expected to be found in makePopulatedMap() and differs from the value returned by MapInterfaceTest.getValueNotInPopulatedMap().
protected  ConcurrentMap<K,V> makeEitherMap()
          Used by tests that require a map, but don't care whether it's populated or not.
protected abstract  ConcurrentMap<K,V> makeEmptyMap()
          Creates a new, empty instance of the class under test.
protected abstract  ConcurrentMap<K,V> makePopulatedMap()
          Creates a new, non-empty instance of the class under test.
 void testPutIfAbsentExistingKey()
           
 void testPutIfAbsentExistingKeyNullValue()
           
 void testPutIfAbsentNewKey()
           
 void testPutIfAbsentNewKeyNullValue()
           
 void testPutIfAbsentNullKey()
           
 void testRemoveKeyValueDifferentValue()
           
 void testRemoveKeyValueExisting()
           
 void testRemoveKeyValueExistingKeyNullValue()
           
 void testRemoveKeyValueMissingKey()
           
 void testRemoveKeyValueMissingKeyNullValue()
           
 void testRemoveKeyValueNullKey()
           
 void testReplace2ExistingKey()
           
 void testReplace2ExistingKeyNullValue()
           
 void testReplace2MissingKey()
           
 void testReplace2MissingKeyNullValue()
           
 void testReplace2NullKey()
           
 void testReplace3ExistingKeyDifferentValue()
           
 void testReplace3ExistingKeyNullOldValue()
           
 void testReplace3ExistingKeyValue()
           
 void testReplace3ExistingKeyValueNullNewValue()
           
 void testReplace3MissingKey()
           
 void testReplace3MissingKeyNullNewValue()
           
 void testReplace3MissingKeyNullOldValue()
           
 void testReplace3NullKey()
           
 
Methods inherited from class com.google.common.collect.testing.MapInterfaceTest
assertInvariants, assertMoreInvariants, getKeyNotInPopulatedMap, getValueNotInPopulatedMap, supportsValuesHashCode, testClear, testContainsKey, testContainsValue, testEntrySet, testEntrySetAddAndAddAll, testEntrySetClear, testEntrySetContainsEntryIncompatibleKey, testEntrySetContainsEntryNullKeyMissing, testEntrySetContainsEntryNullKeyPresent, testEntrySetForEmptyMap, testEntrySetIteratorRemove, testEntrySetRemove, testEntrySetRemoveAll, testEntrySetRemoveAllNullFromEmpty, testEntrySetRemoveDifferentValue, testEntrySetRemoveMissingKey, testEntrySetRemoveNullKeyMissing, testEntrySetRemoveNullKeyPresent, testEntrySetRetainAll, testEntrySetRetainAllNullFromEmpty, testEntrySetSetValue, testEntrySetSetValueSameValue, testEqualsForEmptyMap, testEqualsForEqualMap, testEqualsForLargerMap, testEqualsForSmallerMap, testGet, testGetForEmptyMap, testGetNull, testHashCode, testHashCodeForEmptyMap, testKeySetClear, testKeySetRemove, testKeySetRemoveAll, testKeySetRemoveAllNullFromEmpty, testKeySetRetainAll, testKeySetRetainAllNullFromEmpty, testPutAllExistingKey, testPutAllNewKey, testPutExistingKey, testPutNewKey, testPutNullKey, testPutNullValue, testPutNullValueForExistingKey, testRemove, testRemoveMissingKey, testSize, testValues, testValuesClear, testValuesIteratorRemove, testValuesRemove, testValuesRemoveAll, testValuesRemoveAllNullFromEmpty, testValuesRemoveMissing, testValuesRetainAll, testValuesRetainAllNullFromEmpty
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConcurrentMapInterfaceTest

protected ConcurrentMapInterfaceTest(boolean allowsNullKeys,
                                     boolean allowsNullValues,
                                     boolean supportsPut,
                                     boolean supportsRemove,
                                     boolean supportsClear)
Method Detail

getSecondValueNotInPopulatedMap

protected abstract V getSecondValueNotInPopulatedMap()
                                              throws UnsupportedOperationException
Creates a new value that is not expected to be found in makePopulatedMap() and differs from the value returned by MapInterfaceTest.getValueNotInPopulatedMap().

Returns:
a value
Throws:
UnsupportedOperationException - if it's not possible to make a value that will not be found in the map

makeEmptyMap

protected abstract ConcurrentMap<K,V> makeEmptyMap()
                                            throws UnsupportedOperationException
Description copied from class: MapInterfaceTest
Creates a new, empty instance of the class under test.

Specified by:
makeEmptyMap in class MapInterfaceTest<K,V>
Returns:
a new, empty map instance.
Throws:
UnsupportedOperationException - if it's not possible to make an empty instance of the class under test.

makePopulatedMap

protected abstract ConcurrentMap<K,V> makePopulatedMap()
                                                throws UnsupportedOperationException
Description copied from class: MapInterfaceTest
Creates a new, non-empty instance of the class under test.

Specified by:
makePopulatedMap in class MapInterfaceTest<K,V>
Returns:
a new, non-empty map instance.
Throws:
UnsupportedOperationException - if it's not possible to make a non-empty instance of the class under test.

makeEitherMap

protected ConcurrentMap<K,V> makeEitherMap()
Description copied from class: MapInterfaceTest
Used by tests that require a map, but don't care whether it's populated or not.

Overrides:
makeEitherMap in class MapInterfaceTest<K,V>
Returns:
a new map instance.

testPutIfAbsentNewKey

public void testPutIfAbsentNewKey()

testPutIfAbsentExistingKey

public void testPutIfAbsentExistingKey()

testPutIfAbsentNullKey

public void testPutIfAbsentNullKey()

testPutIfAbsentNewKeyNullValue

public void testPutIfAbsentNewKeyNullValue()

testPutIfAbsentExistingKeyNullValue

public void testPutIfAbsentExistingKeyNullValue()

testRemoveKeyValueExisting

public void testRemoveKeyValueExisting()

testRemoveKeyValueMissingKey

public void testRemoveKeyValueMissingKey()

testRemoveKeyValueDifferentValue

public void testRemoveKeyValueDifferentValue()

testRemoveKeyValueNullKey

public void testRemoveKeyValueNullKey()

testRemoveKeyValueExistingKeyNullValue

public void testRemoveKeyValueExistingKeyNullValue()

testRemoveKeyValueMissingKeyNullValue

public void testRemoveKeyValueMissingKeyNullValue()

testReplace2ExistingKey

public void testReplace2ExistingKey()

testReplace2MissingKey

public void testReplace2MissingKey()

testReplace2NullKey

public void testReplace2NullKey()

testReplace2ExistingKeyNullValue

public void testReplace2ExistingKeyNullValue()

testReplace2MissingKeyNullValue

public void testReplace2MissingKeyNullValue()

testReplace3ExistingKeyValue

public void testReplace3ExistingKeyValue()

testReplace3ExistingKeyDifferentValue

public void testReplace3ExistingKeyDifferentValue()

testReplace3MissingKey

public void testReplace3MissingKey()

testReplace3NullKey

public void testReplace3NullKey()

testReplace3ExistingKeyNullOldValue

public void testReplace3ExistingKeyNullOldValue()

testReplace3MissingKeyNullOldValue

public void testReplace3MissingKeyNullOldValue()

testReplace3MissingKeyNullNewValue

public void testReplace3MissingKeyNullNewValue()

testReplace3ExistingKeyValueNullNewValue

public void testReplace3ExistingKeyValueNullNewValue()


Copyright © 2010-2012. All Rights Reserved.