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

Comparing jsr166/src/test/tck/ScheduledExecutorSubclassTest.java (file contents):
Revision 1.6 by jsr166, Fri Nov 20 22:58:48 2009 UTC vs.
Revision 1.7 by jsr166, Sat Nov 21 02:07:27 2009 UTC

# Line 12 | Line 12 | import java.util.concurrent.atomic.*;
12  
13   public class ScheduledExecutorSubclassTest extends JSR166TestCase {
14      public static void main(String[] args) {
15 <        junit.textui.TestRunner.run (suite());
15 >        junit.textui.TestRunner.run (suite());
16      }
17      public static Test suite() {
18 <        return new TestSuite(ScheduledExecutorSubclassTest.class);
18 >        return new TestSuite(ScheduledExecutorSubclassTest.class);
19      }
20  
21      static class CustomTask<V> implements RunnableScheduledFuture<V> {
# Line 196 | Line 196 | public class ScheduledExecutorSubclassTe
196      public void testExecuteNull() throws InterruptedException {
197          CustomExecutor se = new CustomExecutor(1);
198          try {
199 <            se.execute(null);
199 >            se.execute(null);
200              shouldThrow();
201 <        } catch (NullPointerException success) {}
202 <        joinPool(se);
201 >        } catch (NullPointerException success) {}
202 >        joinPool(se);
203      }
204  
205      /**
# Line 207 | Line 207 | public class ScheduledExecutorSubclassTe
207       */
208      public void testScheduleNull() throws InterruptedException {
209          CustomExecutor se = new CustomExecutor(1);
210 <        try {
210 >        try {
211              TrackedCallable callable = null;
212 <            Future f = se.schedule(callable, SHORT_DELAY_MS, MILLISECONDS);
212 >            Future f = se.schedule(callable, SHORT_DELAY_MS, MILLISECONDS);
213              shouldThrow();
214 <        } catch (NullPointerException success) {}
215 <        joinPool(se);
214 >        } catch (NullPointerException success) {}
215 >        joinPool(se);
216      }
217  
218      /**
# Line 376 | Line 376 | public class ScheduledExecutorSubclassTe
376       */
377      public void testGetThreadFactory() {
378          ThreadFactory tf = new SimpleThreadFactory();
379 <        CustomExecutor p = new CustomExecutor(1, tf);
379 >        CustomExecutor p = new CustomExecutor(1, tf);
380          assertSame(tf, p.getThreadFactory());
381          joinPool(p);
382      }
# Line 386 | Line 386 | public class ScheduledExecutorSubclassTe
386       */
387      public void testSetThreadFactory() {
388          ThreadFactory tf = new SimpleThreadFactory();
389 <        CustomExecutor p = new CustomExecutor(1);
389 >        CustomExecutor p = new CustomExecutor(1);
390          p.setThreadFactory(tf);
391          assertSame(tf, p.getThreadFactory());
392          joinPool(p);
# Line 396 | Line 396 | public class ScheduledExecutorSubclassTe
396       * setThreadFactory(null) throws NPE
397       */
398      public void testSetThreadFactoryNull() {
399 <        CustomExecutor p = new CustomExecutor(1);
399 >        CustomExecutor p = new CustomExecutor(1);
400          try {
401              p.setThreadFactory(null);
402              shouldThrow();
# Line 410 | Line 410 | public class ScheduledExecutorSubclassTe
410       *   is isShutDown is false before shutdown, true after
411       */
412      public void testIsShutdown() {
413 <        CustomExecutor p1 = new CustomExecutor(1);
413 >        CustomExecutor p1 = new CustomExecutor(1);
414          try {
415              assertFalse(p1.isShutdown());
416          }
417          finally {
418              try { p1.shutdown(); } catch (SecurityException ok) { return; }
419          }
420 <        assertTrue(p1.isShutdown());
420 >        assertTrue(p1.isShutdown());
421      }
422  
423  
# Line 425 | Line 425 | public class ScheduledExecutorSubclassTe
425       *  isTerminated is false before termination, true after
426       */
427      public void testIsTerminated() throws InterruptedException {
428 <        CustomExecutor p1 = new CustomExecutor(1);
428 >        CustomExecutor p1 = new CustomExecutor(1);
429          try {
430              p1.execute(new SmallRunnable());
431          } finally {
# Line 439 | Line 439 | public class ScheduledExecutorSubclassTe
439       *  isTerminating is not true when running or when terminated
440       */
441      public void testIsTerminating() throws InterruptedException {
442 <        CustomExecutor p1 = new CustomExecutor(1);
442 >        CustomExecutor p1 = new CustomExecutor(1);
443          assertFalse(p1.isTerminating());
444          try {
445              p1.execute(new SmallRunnable());
# Line 530 | Line 530 | public class ScheduledExecutorSubclassTe
530       *  shutDownNow returns a list containing tasks that were not run
531       */
532      public void testShutDownNow() {
533 <        CustomExecutor p1 = new CustomExecutor(1);
533 >        CustomExecutor p1 = new CustomExecutor(1);
534          for (int i = 0; i < 5; i++)
535              p1.schedule(new SmallPossiblyInterruptedRunnable(), SHORT_DELAY_MS, MILLISECONDS);
536          List l;
# Line 539 | Line 539 | public class ScheduledExecutorSubclassTe
539          } catch (SecurityException ok) {
540              return;
541          }
542 <        assertTrue(p1.isShutdown());
543 <        assertTrue(l.size() > 0 && l.size() <= 5);
542 >        assertTrue(p1.isShutdown());
543 >        assertTrue(l.size() > 0 && l.size() <= 5);
544          joinPool(p1);
545      }
546  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines