[cvs] / jsr166 / src / test / tck / FutureTaskTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/FutureTaskTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6, Thu Sep 25 11:02:41 2003 UTC revision 1.7, Fri Sep 26 15:33:13 2003 UTC
# Line 21  Line 21 
21      /**      /**
22       * Subclass to expose protected methods       * Subclass to expose protected methods
23       */       */
24      static class MyFutureTask extends FutureTask {      static class PublicFutureTask extends FutureTask {
25          public MyFutureTask(Callable r) { super(r); }          public PublicFutureTask(Callable r) { super(r); }
26          public boolean reset() { return super.reset(); }          public boolean reset() { return super.reset(); }
27          public void setCancelled() { super.setCancelled(); }          public void setCancelled() { super.setCancelled(); }
28          public void setDone() { super.setDone(); }          public void setDone() { super.setDone(); }
# Line 68  Line 68 
68       * reset of a done task succeeds and changes status to not done       * reset of a done task succeeds and changes status to not done
69       */       */
70      public void testReset() {      public void testReset() {
71          MyFutureTask task = new MyFutureTask(new NoOpCallable());          PublicFutureTask task = new PublicFutureTask(new NoOpCallable());
72          task.run();          task.run();
73          assertTrue(task.isDone());          assertTrue(task.isDone());
74          assertTrue(task.reset());          assertTrue(task.reset());
# Line 79  Line 79 
79       * Resetting after cancellation fails       * Resetting after cancellation fails
80       */       */
81      public void testResetAfterCancel() {      public void testResetAfterCancel() {
82          MyFutureTask task = new MyFutureTask(new NoOpCallable());          PublicFutureTask task = new PublicFutureTask(new NoOpCallable());
83          assertTrue(task.cancel(false));          assertTrue(task.cancel(false));
84          task.run();          task.run();
85          assertTrue(task.isDone());          assertTrue(task.isDone());
# Line 91  Line 91 
91       * setDone of new task causes isDone to be true       * setDone of new task causes isDone to be true
92       */       */
93      public void testSetDone() {      public void testSetDone() {
94          MyFutureTask task = new MyFutureTask(new NoOpCallable());          PublicFutureTask task = new PublicFutureTask(new NoOpCallable());
95          task.setDone();          task.setDone();
96          assertTrue(task.isDone());          assertTrue(task.isDone());
97          assertFalse(task.isCancelled());          assertFalse(task.isCancelled());
# Line 101  Line 101 
101       * setCancelled of a new task causes isCancelled to be true       * setCancelled of a new task causes isCancelled to be true
102       */       */
103      public void testSetCancelled() {      public void testSetCancelled() {
104          MyFutureTask task = new MyFutureTask(new NoOpCallable());          PublicFutureTask task = new PublicFutureTask(new NoOpCallable());
105          assertTrue(task.cancel(false));          assertTrue(task.cancel(false));
106          task.setCancelled();          task.setCancelled();
107          assertTrue(task.isDone());          assertTrue(task.isDone());
# Line 112  Line 112 
112       * setting value gauses get to return it       * setting value gauses get to return it
113       */       */
114      public void testSet() {      public void testSet() {
115          MyFutureTask task = new MyFutureTask(new NoOpCallable());          PublicFutureTask task = new PublicFutureTask(new NoOpCallable());
116          task.set(one);          task.set(one);
117          try {          try {
118              assertEquals(task.get(), one);              assertEquals(task.get(), one);
# Line 127  Line 127 
127       */       */
128      public void testSetException() {      public void testSetException() {
129          Exception nse = new NoSuchElementException();          Exception nse = new NoSuchElementException();
130          MyFutureTask task = new MyFutureTask(new NoOpCallable());          PublicFutureTask task = new PublicFutureTask(new NoOpCallable());
131          task.setException(nse);          task.setException(nse);
132          try {          try {
133              Object x = task.get();              Object x = task.get();

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8