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

Comparing jsr166/src/test/tck/LockSupportTest.java (file contents):
Revision 1.2 by dl, Sun Sep 14 20:42:40 2003 UTC vs.
Revision 1.3 by dl, Sat Sep 20 18:20:08 2003 UTC

# Line 18 | Line 18 | public class LockSupportTest extends JSR
18          return new TestSuite(LockSupportTest.class);
19      }
20  
21 +    /**
22 +     *
23 +     */
24      public void testUnpark() {
25 <        Thread t = new Thread(new Runnable(){
26 <                public void run(){
27 <                    try{
25 >        Thread t = new Thread(new Runnable() {
26 >                public void run() {
27 >                    try {
28                          LockSupport.park();
29 <                    }catch(Exception e){
30 <                        threadFail("unexpected exception");
29 >                    } catch(Exception e){
30 >                        threadUnexpectedException();
31                      }
32                  }
33              });
34          t.start();
35 <        try{
35 >        try {
36              LockSupport.unpark(t);
37              t.join();
38          }
39          catch(Exception e) {
40 <            fail("unexpected exception");
40 >            unexpectedException();
41          }
42      }
43  
44 +    /**
45 +     *
46 +     */
47      public void testParkNanos() {
48 <        Thread t = new Thread(new Runnable(){
49 <                public void run(){
50 <                    try{
48 >        Thread t = new Thread(new Runnable() {
49 >                public void run() {
50 >                    try {
51                          LockSupport.parkNanos(1000);
52 <                    }catch(Exception e){
53 <                        threadFail("unexpected exception");
52 >                    } catch(Exception e){
53 >                        threadUnexpectedException();
54                      }
55                  }
56              });
57 <        try{
57 >        try {
58              t.start();
59              t.join();
60          }
61          catch(Exception e) {
62 <            fail("unexpected exception");
62 >            unexpectedException();
63          }
64      }
65  
66  
67 +    /**
68 +     *
69 +     */
70      public void testParkUntil() {
71 <        Thread t = new Thread(new Runnable(){
72 <                public void run(){
73 <                    try{
71 >        Thread t = new Thread(new Runnable() {
72 >                public void run() {
73 >                    try {
74                          long d = new Date().getTime() + 100;
75                          LockSupport.parkUntil(d);
76 <                    }catch(Exception e){
77 <                        threadFail("unexpected exception");
76 >                    } catch(Exception e){
77 >                        threadUnexpectedException();
78                      }
79                  }
80              });
81 <        try{
81 >        try {
82              t.start();
83              t.join();
84          }
85          catch(Exception e) {
86 <            fail("unexpected exception");
86 >            unexpectedException();
87          }
88      }
89   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines