--- jsr166/src/test/tck/LinkedBlockingDequeTest.java 2011/03/15 19:47:06 1.35 +++ jsr166/src/test/tck/LinkedBlockingDequeTest.java 2011/05/06 11:22:07 1.37 @@ -617,7 +617,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(SIZE, q.size()); @@ -641,10 +641,10 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertEquals(q.remainingCapacity(), 0); assertEquals(0, q.take()); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(q.remainingCapacity(), 0); @@ -667,7 +667,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SMALL_DELAY_MS); + delay(SMALL_DELAY_MS); t.interrupt(); t.join(); } @@ -699,7 +699,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } @@ -772,25 +772,25 @@ public class LinkedBlockingDequeTest ext /** * putFirst(null) throws NPE */ - public void testPutFirstNull() throws InterruptedException { + public void testPutFirstNull() throws InterruptedException { try { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); q.putFirst(null); shouldThrow(); } catch (NullPointerException success) {} - } + } /** * all elements successfully putFirst are contained */ - public void testPutFirst() throws InterruptedException { - LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); - for (int i = 0; i < SIZE; ++i) { - Integer I = new Integer(i); - q.putFirst(I); - assertTrue(q.contains(I)); - } - assertEquals(0, q.remainingCapacity()); + public void testPutFirst() throws InterruptedException { + LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); + for (int i = 0; i < SIZE; ++i) { + Integer I = new Integer(i); + q.putFirst(I); + assertTrue(q.contains(I)); + } + assertEquals(0, q.remainingCapacity()); } /** @@ -811,7 +811,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(SIZE, q.size()); @@ -835,10 +835,10 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertEquals(q.remainingCapacity(), 0); assertEquals(capacity - 1, q.take()); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(q.remainingCapacity(), 0); @@ -861,7 +861,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SMALL_DELAY_MS); + delay(SMALL_DELAY_MS); t.interrupt(); t.join(); } @@ -887,7 +887,7 @@ public class LinkedBlockingDequeTest ext }}; t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } @@ -908,7 +908,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } @@ -954,7 +954,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } @@ -976,7 +976,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SMALL_DELAY_MS); + delay(SMALL_DELAY_MS); assertTrue(q.offerFirst(zero, SHORT_DELAY_MS, MILLISECONDS)); t.interrupt(); t.join(); @@ -985,25 +985,25 @@ public class LinkedBlockingDequeTest ext /** * putLast(null) throws NPE */ - public void testPutLastNull() throws InterruptedException { + public void testPutLastNull() throws InterruptedException { try { LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); q.putLast(null); shouldThrow(); } catch (NullPointerException success) {} - } + } /** * all elements successfully putLast are contained */ - public void testPutLast() throws InterruptedException { - LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); - for (int i = 0; i < SIZE; ++i) { - Integer I = new Integer(i); - q.putLast(I); - assertTrue(q.contains(I)); - } - assertEquals(0, q.remainingCapacity()); + public void testPutLast() throws InterruptedException { + LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); + for (int i = 0; i < SIZE; ++i) { + Integer I = new Integer(i); + q.putLast(I); + assertTrue(q.contains(I)); + } + assertEquals(0, q.remainingCapacity()); } /** @@ -1024,7 +1024,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(SIZE, q.size()); @@ -1048,10 +1048,10 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); assertEquals(q.remainingCapacity(), 0); assertEquals(0, q.take()); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); assertEquals(q.remainingCapacity(), 0); @@ -1074,7 +1074,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SMALL_DELAY_MS); + delay(SMALL_DELAY_MS); t.interrupt(); t.join(); } @@ -1100,7 +1100,7 @@ public class LinkedBlockingDequeTest ext }}; t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } @@ -1121,7 +1121,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } @@ -1166,7 +1166,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SHORT_DELAY_MS); + delay(SHORT_DELAY_MS); t.interrupt(); t.join(); } @@ -1188,7 +1188,7 @@ public class LinkedBlockingDequeTest ext }}); t.start(); - Thread.sleep(SMALL_DELAY_MS); + delay(SMALL_DELAY_MS); assertTrue(q.offerLast(zero, SHORT_DELAY_MS, MILLISECONDS)); t.interrupt(); t.join(); @@ -1508,7 +1508,7 @@ public class LinkedBlockingDequeTest ext executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { - Thread.sleep(SMALL_DELAY_MS); + delay(SMALL_DELAY_MS); assertSame(one, q.take()); }}); @@ -1530,7 +1530,7 @@ public class LinkedBlockingDequeTest ext executor.execute(new CheckedRunnable() { public void realRun() throws InterruptedException { - Thread.sleep(SMALL_DELAY_MS); + delay(SMALL_DELAY_MS); q.put(one); }});