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

Comparing jsr166/src/test/tck/ThreadLocalRandomTest.java (file contents):
Revision 1.3 by jsr166, Tue Aug 4 10:04:47 2009 UTC vs.
Revision 1.9 by jsr166, Fri May 27 19:44:03 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6   import junit.framework.*;
7   import java.util.concurrent.*;
8   import java.util.*;
9  
10
10   public class ThreadLocalRandomTest extends JSR166TestCase {
11  
12      public static void main(String[] args) {
13 <        junit.textui.TestRunner.run (suite());
13 >        junit.textui.TestRunner.run(suite());
14      }
15      public static Test suite() {
16 <        return new TestSuite(ThreadLocalRandomTest.class);
16 >        return new TestSuite(ThreadLocalRandomTest.class);
17      }
18  
19      /**
# Line 42 | Line 41 | public class ThreadLocalRandomTest exten
41          try {
42              ThreadLocalRandom.current().setSeed(17);
43              shouldThrow();
44 <        } catch (UnsupportedOperationException success) {
46 <        }
44 >        } catch (UnsupportedOperationException success) {}
45      }
46  
47      /**
# Line 68 | Line 66 | public class ThreadLocalRandomTest exten
66          assertTrue(i < NCALLS);
67      }
68  
71
69      /**
70       * Repeated calls to nextBoolean produce at least one different result
71       */
# Line 113 | Line 110 | public class ThreadLocalRandomTest exten
110          assertTrue(i < NCALLS);
111      }
112  
116
113      /**
114       * nextInt(negative) throws IllegalArgumentException;
115       */
116      public void testNextIntBoundedNeg() {
117          try {
118 <            int  f = ThreadLocalRandom.current().nextInt(-17);
118 >            int f = ThreadLocalRandom.current().nextInt(-17);
119              shouldThrow();
120 <        } catch (IllegalArgumentException success) {
125 <        }
120 >        } catch (IllegalArgumentException success) {}
121      }
122  
123      /**
# Line 130 | Line 125 | public class ThreadLocalRandomTest exten
125       */
126      public void testNextIntBadBounds() {
127          try {
128 <            int  f = ThreadLocalRandom.current().nextInt(17, 2);
128 >            int f = ThreadLocalRandom.current().nextInt(17, 2);
129              shouldThrow();
130 <        } catch (IllegalArgumentException success) {
136 <        }
130 >        } catch (IllegalArgumentException success) {}
131      }
132  
139
133      /**
134       * nextInt(bound) returns 0 <= value < bound;
135       * repeated calls produce at least one different result
# Line 157 | Line 150 | public class ThreadLocalRandomTest exten
150          }
151      }
152  
160
153      /**
154       * nextInt(least, bound) returns least <= value < bound;
155       * repeated calls produce at least one different result
# Line 184 | Line 176 | public class ThreadLocalRandomTest exten
176       */
177      public void testNextLongBoundedNeg() {
178          try {
179 <            long  f = ThreadLocalRandom.current().nextLong(-17);
179 >            long f = ThreadLocalRandom.current().nextLong(-17);
180              shouldThrow();
181 <        } catch (IllegalArgumentException success) {
190 <        }
181 >        } catch (IllegalArgumentException success) {}
182      }
183  
184      /**
# Line 195 | Line 186 | public class ThreadLocalRandomTest exten
186       */
187      public void testNextLongBadBounds() {
188          try {
189 <            long  f = ThreadLocalRandom.current().nextLong(17, 2);
189 >            long f = ThreadLocalRandom.current().nextLong(17, 2);
190              shouldThrow();
191 <        } catch (IllegalArgumentException success) {
201 <        }
191 >        } catch (IllegalArgumentException success) {}
192      }
193  
194      /**
# Line 241 | Line 231 | public class ThreadLocalRandomTest exten
231          }
232      }
233  
244
234      /**
235       * nextDouble(least, bound) returns least <= value < bound;
236       * repeated calls produce at least one different result
# Line 263 | Line 252 | public class ThreadLocalRandomTest exten
252          }
253      }
254  
266
255   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines