Class ConcurrentHashMapTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by JSR166TestCase
              extended by ConcurrentHashMapTest
All Implemented Interfaces:
junit.framework.Test

public class ConcurrentHashMapTest
extends JSR166TestCase


Nested Class Summary
 
Nested classes/interfaces inherited from class JSR166TestCase
JSR166TestCase.AdjustablePolicy, JSR166TestCase.CallableOne, JSR166TestCase.CheckedBarrier, JSR166TestCase.CheckedCallable<T>, JSR166TestCase.CheckedInterruptedCallable<T>, JSR166TestCase.CheckedInterruptedRunnable, JSR166TestCase.CheckedRecursiveAction, JSR166TestCase.CheckedRecursiveTask<T>, JSR166TestCase.CheckedRunnable, JSR166TestCase.LongPossiblyInterruptedRunnable, JSR166TestCase.MediumInterruptedRunnable, JSR166TestCase.MediumPossiblyInterruptedRunnable, JSR166TestCase.MediumRunnable, JSR166TestCase.NoOpCallable, JSR166TestCase.NoOpREHandler, JSR166TestCase.NoOpRunnable, JSR166TestCase.NPETask, JSR166TestCase.RunnableShouldThrow, JSR166TestCase.ShortInterruptedRunnable, JSR166TestCase.ShortRunnable, JSR166TestCase.SimpleThreadFactory, JSR166TestCase.SmallCallable, JSR166TestCase.SmallPossiblyInterruptedRunnable, JSR166TestCase.SmallRunnable, JSR166TestCase.StringTask, JSR166TestCase.ThreadShouldThrow, JSR166TestCase.TrackedCallable, JSR166TestCase.TrackedLongRunnable, JSR166TestCase.TrackedMediumRunnable, JSR166TestCase.TrackedNoOpRunnable, JSR166TestCase.TrackedRunnable, JSR166TestCase.TrackedShortRunnable, JSR166TestCase.TrackedSmallRunnable
 
Field Summary
 
Fields inherited from class JSR166TestCase
eight, expensiveTests, five, four, LONG_DELAY_MS, m1, m10, m2, m3, m4, m5, m6, MEDIUM_DELAY_MS, nine, one, seven, SHORT_DELAY_MS, six, SIZE, SMALL_DELAY_MS, TEST_STRING, three, two, zero
 
Constructor Summary
ConcurrentHashMapTest()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static junit.framework.Test suite()
           
 void testClear()
          clear removes all pairs
 void testConstructor1()
          Cannot create with negative capacity
 void testConstructor2()
          Cannot create with negative concurrency level
 void testConstructor3()
          Cannot create with only negative capacity
 void testContains_NullPointerException()
          contains(null) throws NPE
 void testContains()
          contains returns true for contained value
 void testContainsKey_NullPointerException()
          containsKey(null) throws NPE
 void testContainsKey()
          containsKey returns true for contained key
 void testContainsValue_NullPointerException()
          containsValue(null) throws NPE
 void testContainsValue()
          containsValue returns true for held values
 void testEntrySet()
          entrySet contains all pairs
 void testEntrySetToArray()
          entrySet.toArray contains all entries
 void testEnumeration()
          enumeration returns an enumeration containing the correct elements
 void testEquals()
          Maps with same contents are equal
 void testGet_NullPointerException()
          get(null) throws NPE
 void testGet()
          get returns the correct element at the given key, or null if not present
 void testIsEmpty()
          isEmpty is true of empty map and false for non-empty
 void testKeys()
          keys returns an enumeration containing all the keys from the map
 void testKeySet()
          keySet returns a Set containing all the keys
 void testKeySetToArray()
          keySet.toArray returns contains all keys
 void testPut1_NullPointerException()
          put(null,x) throws NPE
 void testPut2_NullPointerException()
          put(x, null) throws NPE
 void testPutAll()
          putAll adds all key-value pairs from the given map
 void testPutIfAbsent()
          putIfAbsent works when the given key is not present
 void testPutIfAbsent1_NullPointerException()
          putIfAbsent(null, x) throws NPE
 void testPutIfAbsent2_NullPointerException()
          putIfAbsent(x, null) throws NPE
 void testPutIfAbsent2()
          putIfAbsent does not add the pair if the key is already present
 void testRemove()
          remove removes the correct key-value pair from the map
 void testRemove1_NullPointerException()
          remove(null) throws NPE
 void testRemove2_NullPointerException()
          remove(null, x) throws NPE
 void testRemove2()
          remove(key,value) removes only if pair present
 void testRemove3()
          remove(x, null) returns false
 void testReplace_NullPointerException()
          replace(null, x) throws NPE
 void testReplace()
          replace fails when the given key is not present
 void testReplace2_NullPointerException()
          replace(x, null) throws NPE
 void testReplace2()
          replace succeeds if the key is already present
 void testReplaceValue_NullPointerException()
          replace(null, x, y) throws NPE
 void testReplaceValue()
          replace value fails when the given key not mapped to expected value
 void testReplaceValue2_NullPointerException()
          replace(x, null, y) throws NPE
 void testReplaceValue2()
          replace value succeeds when the given key mapped to expected value
 void testReplaceValue3_NullPointerException()
          replace(x, y, null) throws NPE
 void testSerialization()
          A deserialized map equals original
 void testSetValueWriteThrough()
          SetValue of an EntrySet entry sets value in the map.
 void testSize()
          size returns the correct values
 void testToString()
          toString contains toString of elements
 void testValues()
          values collection contains all values
 void testValuesToArray()
          Values.toArray contains all values
 
Methods inherited from class JSR166TestCase
assertThreadJoinTimesOut, awaiter, checkEmpty, delay, getShortDelay, joinPool, latchAwaitingStringTask, newTestSuite, permissivePolicy, possiblyInterruptedRunnable, runTest, runTestProfiled, runWithoutPermissions, runWithPermissions, setDelays, setUp, shouldThrow, shouldThrow, tearDown, threadAssertEquals, threadAssertEquals, threadAssertFalse, threadAssertNull, threadAssertSame, threadAssertTrue, threadFail, threadRecordFailure, threadShouldThrow, threadShouldThrow, threadUnexpectedException, trackedRunnable
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, setName, 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

ConcurrentHashMapTest

public ConcurrentHashMapTest()
Method Detail

main

public static void main(java.lang.String[] args)

suite

public static junit.framework.Test suite()

testClear

public void testClear()
clear removes all pairs


testEquals

public void testEquals()
Maps with same contents are equal


testContains

public void testContains()
contains returns true for contained value


testContainsKey

public void testContainsKey()
containsKey returns true for contained key


testContainsValue

public void testContainsValue()
containsValue returns true for held values


testEnumeration

public void testEnumeration()
enumeration returns an enumeration containing the correct elements


testGet

public void testGet()
get returns the correct element at the given key, or null if not present


testIsEmpty

public void testIsEmpty()
isEmpty is true of empty map and false for non-empty


testKeys

public void testKeys()
keys returns an enumeration containing all the keys from the map


testKeySet

public void testKeySet()
keySet returns a Set containing all the keys


testKeySetToArray

public void testKeySetToArray()
keySet.toArray returns contains all keys


testValuesToArray

public void testValuesToArray()
Values.toArray contains all values


testEntrySetToArray

public void testEntrySetToArray()
entrySet.toArray contains all entries


testValues

public void testValues()
values collection contains all values


testEntrySet

public void testEntrySet()
entrySet contains all pairs


testPutAll

public void testPutAll()
putAll adds all key-value pairs from the given map


testPutIfAbsent

public void testPutIfAbsent()
putIfAbsent works when the given key is not present


testPutIfAbsent2

public void testPutIfAbsent2()
putIfAbsent does not add the pair if the key is already present


testReplace

public void testReplace()
replace fails when the given key is not present


testReplace2

public void testReplace2()
replace succeeds if the key is already present


testReplaceValue

public void testReplaceValue()
replace value fails when the given key not mapped to expected value


testReplaceValue2

public void testReplaceValue2()
replace value succeeds when the given key mapped to expected value


testRemove

public void testRemove()
remove removes the correct key-value pair from the map


testRemove2

public void testRemove2()
remove(key,value) removes only if pair present


testSize

public void testSize()
size returns the correct values


testToString

public void testToString()
toString contains toString of elements


testConstructor1

public void testConstructor1()
Cannot create with negative capacity


testConstructor2

public void testConstructor2()
Cannot create with negative concurrency level


testConstructor3

public void testConstructor3()
Cannot create with only negative capacity


testGet_NullPointerException

public void testGet_NullPointerException()
get(null) throws NPE


testContainsKey_NullPointerException

public void testContainsKey_NullPointerException()
containsKey(null) throws NPE


testContainsValue_NullPointerException

public void testContainsValue_NullPointerException()
containsValue(null) throws NPE


testContains_NullPointerException

public void testContains_NullPointerException()
contains(null) throws NPE


testPut1_NullPointerException

public void testPut1_NullPointerException()
put(null,x) throws NPE


testPut2_NullPointerException

public void testPut2_NullPointerException()
put(x, null) throws NPE


testPutIfAbsent1_NullPointerException

public void testPutIfAbsent1_NullPointerException()
putIfAbsent(null, x) throws NPE


testReplace_NullPointerException

public void testReplace_NullPointerException()
replace(null, x) throws NPE


testReplaceValue_NullPointerException

public void testReplaceValue_NullPointerException()
replace(null, x, y) throws NPE


testPutIfAbsent2_NullPointerException

public void testPutIfAbsent2_NullPointerException()
putIfAbsent(x, null) throws NPE


testReplace2_NullPointerException

public void testReplace2_NullPointerException()
replace(x, null) throws NPE


testReplaceValue2_NullPointerException

public void testReplaceValue2_NullPointerException()
replace(x, null, y) throws NPE


testReplaceValue3_NullPointerException

public void testReplaceValue3_NullPointerException()
replace(x, y, null) throws NPE


testRemove1_NullPointerException

public void testRemove1_NullPointerException()
remove(null) throws NPE


testRemove2_NullPointerException

public void testRemove2_NullPointerException()
remove(null, x) throws NPE


testRemove3

public void testRemove3()
remove(x, null) returns false


testSerialization

public void testSerialization()
                       throws java.lang.Exception
A deserialized map equals original

Throws:
java.lang.Exception

testSetValueWriteThrough

public void testSetValueWriteThrough()
SetValue of an EntrySet entry sets value in the map.