Class TimeUnitTest

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

public class TimeUnitTest
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
TimeUnitTest()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static junit.framework.Test suite()
           
 void testConvert()
          convert correctly converts sample values across the units
 void testConvertSaturate()
          convert saturates positive too-large values to Long.MAX_VALUE and negative to LONG.MIN_VALUE
 void testSerialization()
          a deserialized serialized unit is the same instance
 void testTimedJoin()
          timedJoin throws InterruptedException when interrupted
 void testTimedSleep()
          timedSleep throws InterruptedException when interrupted
 void testTimedWait_IllegalMonitorException()
          Timed wait without holding lock throws IllegalMonitorStateException
 void testTimedWait()
          timedWait throws InterruptedException when interrupted
 void testToDays()
          toDays correctly converts sample values in different units to days
 void testToHours()
          toHours correctly converts sample values in different units to hours
 void testToMicros()
          toMicros correctly converts sample values in different units to microseconds
 void testToMillis()
          toMillis correctly converts sample values in different units to milliseconds
 void testToMinutes()
          toMinutes correctly converts sample values in different units to minutes
 void testToNanos()
          toNanos correctly converts sample values in different units to nanoseconds
 void testToNanosSaturate()
          toNanos saturates positive too-large values to Long.MAX_VALUE and negative to LONG.MIN_VALUE
 void testToSeconds()
          toSeconds correctly converts sample values in different units to seconds
 void testToString()
          toString returns string containing common name of unit
 
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

TimeUnitTest

public TimeUnitTest()
Method Detail

main

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

suite

public static junit.framework.Test suite()

testConvert

public void testConvert()
convert correctly converts sample values across the units


testToNanos

public void testToNanos()
toNanos correctly converts sample values in different units to nanoseconds


testToMicros

public void testToMicros()
toMicros correctly converts sample values in different units to microseconds


testToMillis

public void testToMillis()
toMillis correctly converts sample values in different units to milliseconds


testToSeconds

public void testToSeconds()
toSeconds correctly converts sample values in different units to seconds


testToMinutes

public void testToMinutes()
toMinutes correctly converts sample values in different units to minutes


testToHours

public void testToHours()
toHours correctly converts sample values in different units to hours


testToDays

public void testToDays()
toDays correctly converts sample values in different units to days


testConvertSaturate

public void testConvertSaturate()
convert saturates positive too-large values to Long.MAX_VALUE and negative to LONG.MIN_VALUE


testToNanosSaturate

public void testToNanosSaturate()
toNanos saturates positive too-large values to Long.MAX_VALUE and negative to LONG.MIN_VALUE


testToString

public void testToString()
toString returns string containing common name of unit


testTimedWait_IllegalMonitorException

public void testTimedWait_IllegalMonitorException()
                                           throws java.lang.Exception
Timed wait without holding lock throws IllegalMonitorStateException

Throws:
java.lang.Exception

testTimedWait

public void testTimedWait()
                   throws java.lang.InterruptedException
timedWait throws InterruptedException when interrupted

Throws:
java.lang.InterruptedException

testTimedJoin

public void testTimedJoin()
                   throws java.lang.InterruptedException
timedJoin throws InterruptedException when interrupted

Throws:
java.lang.InterruptedException

testTimedSleep

public void testTimedSleep()
                    throws java.lang.InterruptedException
timedSleep throws InterruptedException when interrupted

Throws:
java.lang.InterruptedException

testSerialization

public void testSerialization()
                       throws java.lang.Exception
a deserialized serialized unit is the same instance

Throws:
java.lang.Exception