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

Comparing jsr166/src/test/tck/FutureTaskTest.java (file contents):
Revision 1.49 by jsr166, Sun Oct 22 01:26:49 2017 UTC vs.
Revision 1.51 by jsr166, Sun Jan 7 22:59:18 2018 UTC

# Line 51 | Line 51 | public class FutureTaskTest extends JSR1
51                  exInfo = CancellationException.class;
52              } catch (ExecutionException t) {
53                  exInfo = t.getCause();
54 <            } catch (Exception t) {
54 >            } catch (Throwable t) {
55                  threadUnexpectedException(t);
56              }
57  
# Line 66 | Line 66 | public class FutureTaskTest extends JSR1
66                  assertSame(exInfo, CancellationException.class);
67              } catch (ExecutionException t) {
68                  assertSame(exInfo, t.getCause());
69 <            } catch (Exception t) {
69 >            } catch (Throwable t) {
70                  threadUnexpectedException(t);
71              }
72              assertTrue(f.isDone());
# Line 108 | Line 108 | public class FutureTaskTest extends JSR1
108          try {
109              assertSame(expected, f.get());
110              assertSame(expected, f.get(randomTimeout(), randomTimeUnit()));
111 <        } catch (Exception fail) { threadUnexpectedException(fail); }
111 >        } catch (Throwable fail) { threadUnexpectedException(fail); }
112      }
113  
114      void checkCancelled(Future<?> f) {
# Line 838 | Line 838 | public class FutureTaskTest extends JSR1
838       * toString indicates current completion state
839       */
840      public void testToString_incomplete() {
841 <        FutureTask<String> f = new FutureTask<String>(() -> "");
841 >        FutureTask<String> f = new FutureTask<>(() -> "");
842          assertTrue(f.toString().matches(".*\\[.*Not completed.*\\]"));
843          if (testImplementationDetails)
844              assertTrue(f.toString().startsWith(
# Line 846 | Line 846 | public class FutureTaskTest extends JSR1
846      }
847  
848      public void testToString_normal() {
849 <        FutureTask<String> f = new FutureTask<String>(() -> "");
849 >        FutureTask<String> f = new FutureTask<>(() -> "");
850          f.run();
851          assertTrue(f.toString().matches(".*\\[.*Completed normally.*\\]"));
852          if (testImplementationDetails)
# Line 855 | Line 855 | public class FutureTaskTest extends JSR1
855      }
856  
857      public void testToString_exception() {
858 <        FutureTask<String> f = new FutureTask<String>(
858 >        FutureTask<String> f = new FutureTask<>(
859                  () -> { throw new ArithmeticException(); });
860          f.run();
861          assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]"));
# Line 866 | Line 866 | public class FutureTaskTest extends JSR1
866  
867      public void testToString_cancelled() {
868          for (boolean mayInterruptIfRunning : new boolean[] { true, false }) {
869 <            FutureTask<String> f = new FutureTask<String>(() -> "");
869 >            FutureTask<String> f = new FutureTask<>(() -> "");
870              assertTrue(f.cancel(mayInterruptIfRunning));
871              assertTrue(f.toString().matches(".*\\[.*Cancelled.*\\]"));
872              if (testImplementationDetails)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines