--- jsr166/src/test/tck/SemaphoreTest.java 2003/09/07 20:39:11 1.2 +++ jsr166/src/test/tck/SemaphoreTest.java 2003/09/14 20:42:40 1.3 @@ -10,7 +10,7 @@ import java.util.*; import java.util.concurrent.*; import java.io.*; -public class SemaphoreTest extends TestCase{ +public class SemaphoreTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run (suite()); @@ -20,11 +20,6 @@ public class SemaphoreTest extends TestC return new TestSuite(SemaphoreTest.class); } - private static long SHORT_DELAY_MS = 100; - private static long MEDIUM_DELAY_MS = 1000; - private static long LONG_DELAY_MS = 10000; - - public void testConstructor1() { Semaphore s = new Semaphore(0); assertEquals(0, s.availablePermits()); @@ -92,7 +87,7 @@ public class SemaphoreTest extends TestC s.release(); s.acquire(); }catch(InterruptedException ie){ - fail("unexpected exception"); + threadFail("unexpected exception"); } } }); @@ -133,12 +128,12 @@ public class SemaphoreTest extends TestC public void run(){ try{ s.release(); - assertTrue(s.tryAcquire(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); + threadAssertTrue(s.tryAcquire(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); s.release(); - assertTrue(s.tryAcquire(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); + threadAssertTrue(s.tryAcquire(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); }catch(InterruptedException ie){ - fail("unexpected exception"); + threadFail("unexpected exception"); } } }); @@ -160,7 +155,7 @@ public class SemaphoreTest extends TestC public void run(){ try{ s.acquire(); - fail("should throw"); + threadFail("should throw"); }catch(InterruptedException success){} } }); @@ -180,7 +175,7 @@ public class SemaphoreTest extends TestC public void run(){ try{ s.tryAcquire(MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); - fail("should throw"); + threadFail("should throw"); }catch(InterruptedException success){ } } @@ -197,7 +192,6 @@ public class SemaphoreTest extends TestC public void testSerialization() { Semaphore l = new Semaphore(3); - try { l.acquire(); l.release();