ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/CountDownLatchTest.java
(Generate patch)

Comparing jsr166/src/test/tck/CountDownLatchTest.java (file contents):
Revision 1.20 by jsr166, Sat May 28 12:37:00 2011 UTC vs.
Revision 1.26 by jsr166, Mon May 29 22:44:26 2017 UTC

# Line 6 | Line 6
6   * Pat Fisher, Mike Judd.
7   */
8  
9 import junit.framework.*;
10 import java.util.*;
11 import java.util.concurrent.*;
9   import static java.util.concurrent.TimeUnit.MILLISECONDS;
10  
11 + import java.util.concurrent.CountDownLatch;
12 +
13 + import junit.framework.Test;
14 + import junit.framework.TestSuite;
15 +
16   public class CountDownLatchTest extends JSR166TestCase {
17      public static void main(String[] args) {
18 <        junit.textui.TestRunner.run(suite());
18 >        main(suite(), args);
19      }
20      public static Test suite() {
21          return new TestSuite(CountDownLatchTest.class);
22      }
23  
24      /**
25 <     * negative constructor argument throws IAE
25 >     * negative constructor argument throws IllegalArgumentException
26       */
27      public void testConstructor() {
28          try {
# Line 70 | Line 72 | public class CountDownLatchTest extends
72          assertEquals(2, l.getCount());
73          l.countDown();
74          assertEquals(1, l.getCount());
75 <        assertThreadStaysAlive(t);
75 >        assertThreadBlocks(t, Thread.State.WAITING);
76          l.countDown();
77          assertEquals(0, l.getCount());
78          awaitTermination(t);
# Line 95 | Line 97 | public class CountDownLatchTest extends
97          assertEquals(2, l.getCount());
98          l.countDown();
99          assertEquals(1, l.getCount());
100 <        assertThreadStaysAlive(t);
100 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
101          l.countDown();
102          assertEquals(0, l.getCount());
103          awaitTermination(t);
104      }
105  
106      /**
107 <     * await throws IE if interrupted before counted down
107 >     * await throws InterruptedException if interrupted before counted down
108       */
109      public void testAwait_Interruptible() {
110          final CountDownLatch l = new CountDownLatch(1);
# Line 127 | Line 129 | public class CountDownLatchTest extends
129              }});
130  
131          await(pleaseInterrupt);
132 <        assertThreadStaysAlive(t);
132 >        assertThreadBlocks(t, Thread.State.WAITING);
133          t.interrupt();
134          awaitTermination(t);
135      }
136  
137      /**
138 <     * timed await throws IE if interrupted before counted down
138 >     * timed await throws InterruptedException if interrupted before counted down
139       */
140      public void testTimedAwait_Interruptible() {
141          final CountDownLatch l = new CountDownLatch(1);
# Line 158 | Line 160 | public class CountDownLatchTest extends
160              }});
161  
162          await(pleaseInterrupt);
163 <        assertThreadStaysAlive(t);
163 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
164          t.interrupt();
165          awaitTermination(t);
166      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines