use of com.hazelcast.scheduledexecutor.impl.DelegatingScheduledFutureStripper in project hazelcast by hazelcast.
the class DelegatingScheduledFutureStripperTest method isCancelled.
@Test
public void isCancelled() throws ExecutionException, InterruptedException {
ScheduledFuture outter = mock(ScheduledFuture.class);
ScheduledFuture inner = mock(ScheduledFuture.class);
when(outter.get()).thenReturn(inner);
when(outter.isCancelled()).thenReturn(false);
when(inner.isCancelled()).thenReturn(false);
assertFalse(new DelegatingScheduledFutureStripper(outter).isCancelled());
when(outter.isCancelled()).thenReturn(true);
when(inner.isCancelled()).thenReturn(false);
assertTrue(new DelegatingScheduledFutureStripper(outter).isCancelled());
when(outter.isCancelled()).thenReturn(false);
when(inner.isCancelled()).thenReturn(true);
assertTrue(new DelegatingScheduledFutureStripper(outter).isCancelled());
}
use of com.hazelcast.scheduledexecutor.impl.DelegatingScheduledFutureStripper in project hazelcast by hazelcast.
the class DelegatingScheduledFutureStripperTest method isDone.
@Test
public void isDone() throws ExecutionException, InterruptedException {
ScheduledFuture outter = mock(ScheduledFuture.class);
ScheduledFuture inner = mock(ScheduledFuture.class);
when(outter.get()).thenReturn(inner);
when(outter.isDone()).thenReturn(true);
when(inner.isDone()).thenReturn(false);
assertFalse(new DelegatingScheduledFutureStripper(outter).isDone());
when(outter.isDone()).thenReturn(true);
when(inner.isDone()).thenReturn(true);
assertTrue(new DelegatingScheduledFutureStripper(outter).isDone());
}
use of com.hazelcast.scheduledexecutor.impl.DelegatingScheduledFutureStripper in project hazelcast by hazelcast.
the class DelegatingScheduledFutureStripperTest method get_interrupted.
@Test(expected = InterruptedException.class)
public void get_interrupted() throws ExecutionException, InterruptedException {
ScheduledFuture outter = mock(ScheduledFuture.class);
ScheduledFuture inner = mock(ScheduledFuture.class);
when(outter.get()).thenThrow(new InterruptedException());
when(inner.get()).thenReturn(2);
new DelegatingScheduledFutureStripper(outter).get();
}
use of com.hazelcast.scheduledexecutor.impl.DelegatingScheduledFutureStripper in project hazelcast by hazelcast.
the class DelegatingScheduledFutureStripperTest method get_executionExc.
@Test(expected = ExecutionException.class)
public void get_executionExc() throws ExecutionException, InterruptedException {
ScheduledFuture outter = mock(ScheduledFuture.class);
ScheduledFuture inner = mock(ScheduledFuture.class);
when(outter.get()).thenThrow(new ExecutionException(new NullPointerException()));
when(inner.get()).thenReturn(2);
new DelegatingScheduledFutureStripper(outter).get();
}
Aggregations