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

Comparing jsr166/src/test/tck/RecursiveTaskTest.java (file contents):
Revision 1.36 by jsr166, Mon May 29 19:15:02 2017 UTC vs.
Revision 1.40 by jsr166, Wed Nov 21 23:42:12 2018 UTC

# Line 82 | Line 82 | public class RecursiveTaskTest extends J
82          } catch (Throwable fail) { threadUnexpectedException(fail); }
83      }
84  
85 <    <T> void checkCompletedNormally(RecursiveTask<T> a, T expected) {
85 >    <T> void checkCompletedNormally(RecursiveTask<T> a, T expectedValue) {
86          assertTrue(a.isDone());
87          assertFalse(a.isCancelled());
88          assertTrue(a.isCompletedNormally());
89          assertFalse(a.isCompletedAbnormally());
90          assertNull(a.getException());
91 <        assertSame(expected, a.getRawResult());
92 <        assertSame(expected, a.join());
91 >        assertSame(expectedValue, a.getRawResult());
92 >        assertSame(expectedValue, a.join());
93          assertFalse(a.cancel(false));
94          assertFalse(a.cancel(true));
95 +
96 +        T v1 = null, v2 = null;
97          try {
98 <            assertSame(expected, a.get());
99 <            assertSame(expected, a.get(randomTimeout(), randomTimeUnit()));
98 >            v1 = a.get();
99 >            v2 = a.get(randomTimeout(), randomTimeUnit());
100          } catch (Throwable fail) { threadUnexpectedException(fail); }
101 +        assertSame(expectedValue, v1);
102 +        assertSame(expectedValue, v2);
103      }
104  
105      /**
106       * Waits for the task to complete, and checks that when it does,
107       * it will have an Integer result equals to the given int.
108       */
109 <    void checkCompletesNormally(RecursiveTask<Integer> a, int expected) {
109 >    void checkCompletesNormally(RecursiveTask<Integer> a, int expectedValue) {
110          Integer r = a.join();
111 <        assertEquals(expected, (int) r);
111 >        assertEquals(expectedValue, (int) r);
112          checkCompletedNormally(a, r);
113      }
114  
# Line 112 | Line 116 | public class RecursiveTaskTest extends J
116       * Like checkCompletesNormally, but verifies that the task has
117       * already completed.
118       */
119 <    void checkCompletedNormally(RecursiveTask<Integer> a, int expected) {
119 >    void checkCompletedNormally(RecursiveTask<Integer> a, int expectedValue) {
120          Integer r = a.getRawResult();
121 <        assertEquals(expected, (int) r);
121 >        assertEquals(expectedValue, (int) r);
122          checkCompletedNormally(a, r);
123      }
124  
# Line 194 | Line 198 | public class RecursiveTaskTest extends J
198                  return n;
199              FibTask f1 = new FibTask(n - 1);
200              f1.fork();
201 <            return (new FibTask(n - 2)).compute() + f1.join();
201 >            return new FibTask(n - 2).compute() + f1.join();
202          }
203  
204          public void publicSetRawResult(Integer result) {
# Line 213 | Line 217 | public class RecursiveTaskTest extends J
217                  throw new FJException();
218              FailingFibTask f1 = new FailingFibTask(n - 1);
219              f1.fork();
220 <            return (new FibTask(n - 2)).compute() + f1.join();
220 >            return new FibTask(n - 2).compute() + f1.join();
221          }
222      }
223  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines