--- jsr166/src/test/tck/DelayQueueTest.java 2003/10/05 23:00:40 1.6 +++ jsr166/src/test/tck/DelayQueueTest.java 2004/06/01 12:54:09 1.10 @@ -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. */ import junit.framework.*; @@ -21,14 +22,14 @@ public class DelayQueueTest extends JSR1 private static final int NOCAP = Integer.MAX_VALUE; /** - * A delayed implmentation for testing. + * A delayed implementation for testing. * Most tests use Pseudodelays, where delays are all elapsed * (so, no blocking solely for delays) but are still ordered */ static class PDelay implements Delayed { int pseudodelay; PDelay(int i) { pseudodelay = Integer.MIN_VALUE + i; } - public int compareTo(Object y) { + public int compareTo(PDelay y) { int i = pseudodelay; int j = ((PDelay)y).pseudodelay; if (i < j) return -1; @@ -36,7 +37,7 @@ public class DelayQueueTest extends JSR1 return 0; } - public int compareTo(PDelay y) { + public int compareTo(Delayed y) { int i = pseudodelay; int j = ((PDelay)y).pseudodelay; if (i < j) return -1; @@ -73,7 +74,7 @@ public class DelayQueueTest extends JSR1 NanoDelay(long i) { trigger = System.nanoTime() + i; } - public int compareTo(Object y) { + public int compareTo(NanoDelay y) { long i = trigger; long j = ((NanoDelay)y).trigger; if (i < j) return -1; @@ -81,7 +82,7 @@ public class DelayQueueTest extends JSR1 return 0; } - public int compareTo(NanoDelay y) { + public int compareTo(Delayed y) { long i = trigger; long j = ((NanoDelay)y).trigger; if (i < j) return -1; @@ -763,7 +764,7 @@ public class DelayQueueTest extends JSR1 } /** - * toArray with incompatable array type throws CCE + * toArray with incompatible array type throws CCE */ public void testToArray1_BadArg() { try { @@ -852,7 +853,7 @@ public class DelayQueueTest extends JSR1 /** - * Dekayed actions do not occur until their delay elapses + * Delayed actions do not occur until their delay elapses */ public void testDelay() { DelayQueue q = new DelayQueue(); @@ -932,7 +933,7 @@ public class DelayQueueTest extends JSR1 q.drainTo(l); assertTrue(l.size() >= SIZE); t.join(); - assertTrue(q.size() + l.size() == SIZE+1); + assertTrue(q.size() + l.size() >= SIZE); } catch(Exception e){ unexpectedException(); }