--- jsr166/src/test/tck/TimeUnitTest.java 2003/09/20 18:20:08 1.4 +++ jsr166/src/test/tck/TimeUnitTest.java 2003/12/29 19:05:40 1.7 @@ -1,8 +1,9 @@ /* - * Written by members of JCP JSR-166 Expert Group and released to the - * public domain. Use, modify, and redistribute this code in any way - * without acknowledgement. Other contributors include Andrew Wright, - * Jeffrey Hayes, Pat Fischer, Mike Judd. + * Written by Doug Lea with assistance from members of JCP JSR-166 + * Expert Group and released to the public domain, as explained at + * http://creativecommons.org/licenses/publicdomain + * Other contributors include Andrew Wright, Jeffrey Hayes, + * Pat Fisher, Mike Judd. */ @@ -20,7 +21,7 @@ public class TimeUnitTest extends JSR166 } /** - * + * convert correctly converts sample values across the four units */ public void testConvert() { for (long t = 0; t < 10; ++t) { @@ -76,7 +77,8 @@ public class TimeUnitTest extends JSR166 } /** - * + * toNanos correctly converts sample values in different units to + * nanoseconds */ public void testToNanos() { for (long t = 0; t < 10; ++t) { @@ -93,7 +95,8 @@ public class TimeUnitTest extends JSR166 } /** - * + * toMicros correctly converts sample values in different units to + * microseconds */ public void testToMicros() { for (long t = 0; t < 10; ++t) { @@ -110,7 +113,8 @@ public class TimeUnitTest extends JSR166 } /** - * + * toMillis correctly converts sample values in different units to + * milliseconds */ public void testToMillis() { for (long t = 0; t < 10; ++t) { @@ -127,7 +131,8 @@ public class TimeUnitTest extends JSR166 } /** - * + * toSeconds correctly converts sample values in different units to + * seconds */ public void testToSeconds() { for (long t = 0; t < 10; ++t) { @@ -145,7 +150,8 @@ public class TimeUnitTest extends JSR166 /** - * + * convert saturates positive too-large values to Long.MAX_VALUE + * and negative to LONG.MIN_VALUE */ public void testConvertSaturate() { assertEquals(Long.MAX_VALUE, @@ -154,23 +160,22 @@ public class TimeUnitTest extends JSR166 assertEquals(Long.MIN_VALUE, TimeUnit.NANOSECONDS.convert(-Long.MAX_VALUE / 4, TimeUnit.SECONDS)); - } /** - * + * toNanos saturates positive too-large values to Long.MAX_VALUE + * and negative to LONG.MIN_VALUE */ public void testToNanosSaturate() { assertEquals(Long.MAX_VALUE, TimeUnit.MILLISECONDS.toNanos(Long.MAX_VALUE / 2)); assertEquals(Long.MIN_VALUE, TimeUnit.MILLISECONDS.toNanos(-Long.MAX_VALUE / 3)); - } /** - * + * toString returns string containing common name of unit */ public void testToString() { String s = TimeUnit.SECONDS.toString(); @@ -182,9 +187,6 @@ public class TimeUnitTest extends JSR166 * Timed wait without holding lock throws * IllegalMonitorStateException */ - /** - * - */ public void testTimedWait_IllegalMonitorException() { //created a new thread with anonymous runnable @@ -215,13 +217,7 @@ public class TimeUnitTest extends JSR166 } /** - * timedWait will throw InterruptedException. - * Thread t waits on timedWait while the main thread interrupts it. - * Note: This does not throw IllegalMonitorException since timeWait - * is synchronized on o - */ - /** - * + * timedWait throws InterruptedException when interrupted */ public void testTimedWait() { Thread t = new Thread(new Runnable() { @@ -253,11 +249,7 @@ public class TimeUnitTest extends JSR166 /** - * timedJoin will throw InterruptedException. - * Thread t waits on timedJoin while the main thread interrupts it. - */ - /** - * + * timedJoin throws InterruptedException when interrupted */ public void testTimedJoin() { Thread t = new Thread(new Runnable() { @@ -289,11 +281,7 @@ public class TimeUnitTest extends JSR166 } /** - * timedSleep will throw InterruptedException. - * Thread t waits on timedSleep while the main thread interrupts it. - */ - /** - * + * timedSleep throws InterruptedException when interrupted */ public void testTimedSleep() { //created a new thread with anonymous runnable @@ -319,7 +307,7 @@ public class TimeUnitTest extends JSR166 } /** - * + * a deserialized serialized unit is equal */ public void testSerialization() { TimeUnit q = TimeUnit.MILLISECONDS;