Class CountDownLatchTest

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

public class CountDownLatchTest
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
CountDownLatchTest()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static junit.framework.Test suite()
           
 void testAwait_InterruptedException()
          await throws IE if interrupted before counted down
 void testAwait()
          await returns after countDown to zero, but not before
 void testAwaitTimeout()
          timed await times out if not counted down before timeout
 void testConstructor()
          negative constructor argument throws IAE
 void testCountDown()
          countDown decrements count when positive and has no effect when zero
 void testGetCount()
          getCount returns initial count and decreases after countDown
 void testTimedAwait_InterruptedException()
          timed await throws IE if interrupted before counted down
 void testTimedAwait()
          timed await returns after countDown to zero
 void testToString()
          toString indicates current count
 
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

CountDownLatchTest

public CountDownLatchTest()
Method Detail

main

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

suite

public static junit.framework.Test suite()

testConstructor

public void testConstructor()
negative constructor argument throws IAE


testGetCount

public void testGetCount()
getCount returns initial count and decreases after countDown


testCountDown

public void testCountDown()
countDown decrements count when positive and has no effect when zero


testAwait

public void testAwait()
               throws java.lang.InterruptedException
await returns after countDown to zero, but not before

Throws:
java.lang.InterruptedException

testTimedAwait

public void testTimedAwait()
                    throws java.lang.InterruptedException
timed await returns after countDown to zero

Throws:
java.lang.InterruptedException

testAwait_InterruptedException

public void testAwait_InterruptedException()
                                    throws java.lang.InterruptedException
await throws IE if interrupted before counted down

Throws:
java.lang.InterruptedException

testTimedAwait_InterruptedException

public void testTimedAwait_InterruptedException()
                                         throws java.lang.InterruptedException
timed await throws IE if interrupted before counted down

Throws:
java.lang.InterruptedException

testAwaitTimeout

public void testAwaitTimeout()
                      throws java.lang.InterruptedException
timed await times out if not counted down before timeout

Throws:
java.lang.InterruptedException

testToString

public void testToString()
toString indicates current count