public void testGetCheckedUntimed_interrupted() { SettableFuture<String> future = SettableFuture.create(); Thread.currentThread().interrupt(); try { getChecked(future, TwoArgConstructorException.class); fail(); } catch (TwoArgConstructorException expected) { assertThat(expected.getCause()).isInstanceOf(InterruptedException.class); assertTrue(Thread.currentThread().isInterrupted()); } finally { Thread.interrupted(); } }
public void testGetCheckedUntimed_cancelled() throws TwoArgConstructorException { SettableFuture<String> future = SettableFuture.create(); future.cancel(true); try { getChecked(future, TwoArgConstructorException.class); fail(); } catch (CancellationException expected) { } }
public void testGetCheckedUntimed_ExecutionExceptionChecked() { try { getChecked(FAILED_FUTURE_CHECKED_EXCEPTION, TwoArgConstructorException.class); fail(); } catch (TwoArgConstructorException expected) { assertEquals(CHECKED_EXCEPTION, expected.getCause()); } }
public void testGetCheckedUntimed_ExecutionExceptionUnchecked() throws TwoArgConstructorException { try { getChecked(FAILED_FUTURE_UNCHECKED_EXCEPTION, TwoArgConstructorException.class); fail(); } catch (UncheckedExecutionException expected) { assertEquals(UNCHECKED_EXCEPTION, expected.getCause()); } }
public void testGetCheckedUntimed_ExecutionExceptionError() throws TwoArgConstructorException { try { getChecked(FAILED_FUTURE_ERROR, TwoArgConstructorException.class); fail(); } catch (ExecutionError expected) { assertEquals(ERROR, expected.getCause()); } }
public void testGetCheckedUntimed_ExecutionExceptionOtherThrowable() { try { getChecked(FAILED_FUTURE_OTHER_THROWABLE, TwoArgConstructorException.class); fail(); } catch (TwoArgConstructorException expected) { assertEquals(OTHER_THROWABLE, expected.getCause()); } }
public void testGetCheckedUntimed_RuntimeException() throws TwoArgConstructorException { try { getChecked(RUNTIME_EXCEPTION_FUTURE, TwoArgConstructorException.class); fail(); } catch (RuntimeException expected) { assertEquals(RUNTIME_EXCEPTION, expected); } }
public void testGetCheckedUntimed_Error() throws TwoArgConstructorException { try { getChecked(ERROR_FUTURE, TwoArgConstructorException.class); } catch (Error expected) { assertEquals(ERROR, expected); return; } fail(); }
public void testGetCheckedTimed_interrupted() { SettableFuture<String> future = SettableFuture.create(); Thread.currentThread().interrupt(); try { getChecked(future, TwoArgConstructorException.class, 0, SECONDS); fail(); } catch (TwoArgConstructorException expected) { assertThat(expected.getCause()).isInstanceOf(InterruptedException.class); assertTrue(Thread.currentThread().isInterrupted()); } finally { Thread.interrupted(); } }
public void testGetCheckedTimed_cancelled() throws TwoArgConstructorException { SettableFuture<String> future = SettableFuture.create(); future.cancel(true); try { getChecked(future, TwoArgConstructorException.class, 0, SECONDS); fail(); } catch (CancellationException expected) { } }
public void testGetCheckedTimed_ExecutionExceptionChecked() { try { getChecked(FAILED_FUTURE_CHECKED_EXCEPTION, TwoArgConstructorException.class, 0, SECONDS); fail(); } catch (TwoArgConstructorException expected) { assertEquals(CHECKED_EXCEPTION, expected.getCause()); } }
public void testGetCheckedTimed_ExecutionExceptionUnchecked() throws TwoArgConstructorException { try { getChecked(FAILED_FUTURE_UNCHECKED_EXCEPTION, TwoArgConstructorException.class, 0, SECONDS); fail(); } catch (UncheckedExecutionException expected) { assertEquals(UNCHECKED_EXCEPTION, expected.getCause()); } }
public void testGetCheckedTimed_ExecutionExceptionError() throws TwoArgConstructorException { try { getChecked(FAILED_FUTURE_ERROR, TwoArgConstructorException.class, 0, SECONDS); fail(); } catch (ExecutionError expected) { assertEquals(ERROR, expected.getCause()); } }
public void testGetCheckedTimed_ExecutionExceptionOtherThrowable() { try { getChecked(FAILED_FUTURE_OTHER_THROWABLE, TwoArgConstructorException.class, 0, SECONDS); fail(); } catch (TwoArgConstructorException expected) { assertEquals(OTHER_THROWABLE, expected.getCause()); } }
public void testGetCheckedTimed_RuntimeException() throws TwoArgConstructorException { try { getChecked(RUNTIME_EXCEPTION_FUTURE, TwoArgConstructorException.class, 0, SECONDS); fail(); } catch (RuntimeException expected) { assertEquals(RUNTIME_EXCEPTION, expected); } }
public void testGetCheckedTimed_Error() throws TwoArgConstructorException { try { getChecked(ERROR_FUTURE, TwoArgConstructorException.class, 0, SECONDS); } catch (Error expected) { assertEquals(ERROR, expected); return; } fail(); }
public void testGetCheckedTimed_TimeoutException() { SettableFuture<String> future = SettableFuture.create(); try { getChecked(future, TwoArgConstructorException.class, 0, SECONDS); fail(); } catch (TwoArgConstructorException expected) { assertThat(expected.getCause()).isInstanceOf(TimeoutException.class); } }