Class CopyOnWriteArrayListTest

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

public class CopyOnWriteArrayListTest
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
CopyOnWriteArrayListTest()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static junit.framework.Test suite()
           
 void testAdd1_IndexOutOfBoundsException()
          add throws an IndexOutOfBoundsException on a negative index
 void testAdd2_IndexOutOfBoundsException()
          add throws an IndexOutOfBoundsException on a too high index
 void testAddAll()
          addAll adds each element from the given collection
 void testAddAll1_IndexOutOfBoundsException()
          addAll throws an IndexOutOfBoundsException on a negative index
 void testAddAll2_IndexOutOfBoundsException()
          addAll throws an IndexOutOfBoundsException on a too high index
 void testAddAllAbsent()
          addAllAbsent adds each element from the given collection that did not already exist in the List
 void testAddIfAbsent()
          addIfAbsent will not add the element if it already exists in the list
 void testAddIfAbsent2()
          addIfAbsent adds the element when it does not exist in the list
 void testAddIndex()
          adding at an index places it in the indicated index
 void testClear()
          clear removes all elements from the list
 void testClone()
          Cloned list is equal
 void testConstructor()
          a new list is empty
 void testConstructor2()
          new list contains all elements of initializing array
 void testConstructor3()
          new list contains all elements of initializing collection
 void testContains()
          contains is true for added elements
 void testContainsAll()
          containsAll returns true for collection with subset of elements
 void testEquals()
          lists with same elements are equal and have same hashCode
 void testGet()
          get returns the value at the given index
 void testGet1_IndexOutOfBoundsException()
          get throws an IndexOutOfBoundsException on a negative index
 void testGet2_IndexOutOfBoundsException()
          get throws an IndexOutOfBoundsException on a too high index
 void testIndexOf()
          indexOf gives the index for the given object
 void testIndexOf2()
          indexOf gives the index based on the given index at which to start searching
 void testIsEmpty()
          isEmpty returns true when empty, else false
 void testIterator()
          iterator() returns an iterator containing the elements of the list
 void testIteratorRemove()
          iterator.remove throws UnsupportedOperationException
 void testLastIndexOf1()
          lastIndexOf returns the index for the given object
 void testlastIndexOf2()
          lastIndexOf returns the index from the given starting point
 void testListIterator1_IndexOutOfBoundsException()
          listIterator throws an IndexOutOfBoundsException on a negative index
 void testListIterator1()
          listIterator traverses all elements
 void testListIterator2_IndexOutOfBoundsException()
          listIterator throws an IndexOutOfBoundsException on a too high index
 void testListIterator2()
          listIterator only returns those elements after the given index
 void testRemove()
          remove removes and returns the object at the given index
 void testRemove1_IndexOutOfBounds()
          remove throws an IndexOutOfBoundsException on a negative index
 void testRemove2_IndexOutOfBounds()
          remove throws an IndexOutOfBoundsException on a too high index
 void testRemoveAll()
          removeAll removes all elements from the given collection
 void testSerialization()
          a deserialized serialized list is equal
 void testSet()
          set changes the element at the given index
 void testSet1_IndexOutOfBoundsException()
          set throws an IndexOutOfBoundsException on a negative index
 void testSet2()
          set throws an IndexOutOfBoundsException on a too high index
 void testSize()
          size returns the number of elements
 void testSubList()
          sublists contains elements at indexes offset from their base
 void testSubList1_IndexOutOfBoundsException()
          subList throws an IndexOutOfBoundsException on a negative index
 void testSubList2_IndexOutOfBoundsException()
          subList throws an IndexOutOfBoundsException on a too high index
 void testSubList3_IndexOutOfBoundsException()
          subList throws IndexOutOfBoundsException when the second index is lower then the first
 void testToArray_ArrayStoreException()
          toArray throws an ArrayStoreException when the given array can not store the objects inside the list
 void testToArray()
          toArray returns an Object array containing all elements from the list
 void testToArray2()
          toArray returns an Integer array containing all elements from the list
 void testToString()
          toString contains toString of elements
 
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

CopyOnWriteArrayListTest

public CopyOnWriteArrayListTest()
Method Detail

main

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

suite

public static junit.framework.Test suite()

testConstructor

public void testConstructor()
a new list is empty


testConstructor2

public void testConstructor2()
new list contains all elements of initializing array


testConstructor3

public void testConstructor3()
new list contains all elements of initializing collection


testAddAll

public void testAddAll()
addAll adds each element from the given collection


testAddAllAbsent

public void testAddAllAbsent()
addAllAbsent adds each element from the given collection that did not already exist in the List


testAddIfAbsent

public void testAddIfAbsent()
addIfAbsent will not add the element if it already exists in the list


testAddIfAbsent2

public void testAddIfAbsent2()
addIfAbsent adds the element when it does not exist in the list


testClear

public void testClear()
clear removes all elements from the list


testClone

public void testClone()
Cloned list is equal


testContains

public void testContains()
contains is true for added elements


testAddIndex

public void testAddIndex()
adding at an index places it in the indicated index


testEquals

public void testEquals()
lists with same elements are equal and have same hashCode


testContainsAll

public void testContainsAll()
containsAll returns true for collection with subset of elements


testGet

public void testGet()
get returns the value at the given index


testIndexOf

public void testIndexOf()
indexOf gives the index for the given object


testIndexOf2

public void testIndexOf2()
indexOf gives the index based on the given index at which to start searching


testIsEmpty

public void testIsEmpty()
isEmpty returns true when empty, else false


testIterator

public void testIterator()
iterator() returns an iterator containing the elements of the list


testIteratorRemove

public void testIteratorRemove()
iterator.remove throws UnsupportedOperationException


testToString

public void testToString()
toString contains toString of elements


testLastIndexOf1

public void testLastIndexOf1()
lastIndexOf returns the index for the given object


testlastIndexOf2

public void testlastIndexOf2()
lastIndexOf returns the index from the given starting point


testListIterator1

public void testListIterator1()
listIterator traverses all elements


testListIterator2

public void testListIterator2()
listIterator only returns those elements after the given index


testRemove

public void testRemove()
remove removes and returns the object at the given index


testRemoveAll

public void testRemoveAll()
removeAll removes all elements from the given collection


testSet

public void testSet()
set changes the element at the given index


testSize

public void testSize()
size returns the number of elements


testToArray

public void testToArray()
toArray returns an Object array containing all elements from the list


testToArray2

public void testToArray2()
toArray returns an Integer array containing all elements from the list


testSubList

public void testSubList()
sublists contains elements at indexes offset from their base


testToArray_ArrayStoreException

public void testToArray_ArrayStoreException()
toArray throws an ArrayStoreException when the given array can not store the objects inside the list


testGet1_IndexOutOfBoundsException

public void testGet1_IndexOutOfBoundsException()
get throws an IndexOutOfBoundsException on a negative index


testGet2_IndexOutOfBoundsException

public void testGet2_IndexOutOfBoundsException()
get throws an IndexOutOfBoundsException on a too high index


testSet1_IndexOutOfBoundsException

public void testSet1_IndexOutOfBoundsException()
set throws an IndexOutOfBoundsException on a negative index


testSet2

public void testSet2()
set throws an IndexOutOfBoundsException on a too high index


testAdd1_IndexOutOfBoundsException

public void testAdd1_IndexOutOfBoundsException()
add throws an IndexOutOfBoundsException on a negative index


testAdd2_IndexOutOfBoundsException

public void testAdd2_IndexOutOfBoundsException()
add throws an IndexOutOfBoundsException on a too high index


testRemove1_IndexOutOfBounds

public void testRemove1_IndexOutOfBounds()
remove throws an IndexOutOfBoundsException on a negative index


testRemove2_IndexOutOfBounds

public void testRemove2_IndexOutOfBounds()
remove throws an IndexOutOfBoundsException on a too high index


testAddAll1_IndexOutOfBoundsException

public void testAddAll1_IndexOutOfBoundsException()
addAll throws an IndexOutOfBoundsException on a negative index


testAddAll2_IndexOutOfBoundsException

public void testAddAll2_IndexOutOfBoundsException()
addAll throws an IndexOutOfBoundsException on a too high index


testListIterator1_IndexOutOfBoundsException

public void testListIterator1_IndexOutOfBoundsException()
listIterator throws an IndexOutOfBoundsException on a negative index


testListIterator2_IndexOutOfBoundsException

public void testListIterator2_IndexOutOfBoundsException()
listIterator throws an IndexOutOfBoundsException on a too high index


testSubList1_IndexOutOfBoundsException

public void testSubList1_IndexOutOfBoundsException()
subList throws an IndexOutOfBoundsException on a negative index


testSubList2_IndexOutOfBoundsException

public void testSubList2_IndexOutOfBoundsException()
subList throws an IndexOutOfBoundsException on a too high index


testSubList3_IndexOutOfBoundsException

public void testSubList3_IndexOutOfBoundsException()
subList throws IndexOutOfBoundsException when the second index is lower then the first


testSerialization

public void testSerialization()
                       throws java.lang.Exception
a deserialized serialized list is equal

Throws:
java.lang.Exception