Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
skuzzle committed Aug 12, 2016
1 parent 9854917 commit ffb9d8b
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.lang.reflect.Method;
import java.util.concurrent.Future;
Expand Down Expand Up @@ -71,6 +72,11 @@ public void testCancelNoFuture() throws Exception {
this.subject.cancel(false);
}

@Test(expected = IllegalStateException.class)
public void testIsCancelledNoFuture() throws Exception {
this.subject.isCancelled();
}

@Test
public void testCancel() throws Exception {
final Future<?> future = mock(Future.class);
Expand All @@ -83,4 +89,13 @@ public void testCancel() throws Exception {
public void testSetFutureNull() throws Exception {
this.subject.setFuture(null);
}

@Test
public void testIsCancelled() throws Exception {
final Future<?> future = mock(Future.class);
when(future.isCancelled()).thenReturn(true);
this.subject.setFuture(future);
assertTrue(this.subject.isCancelled());
}

}

0 comments on commit ffb9d8b

Please sign in to comment.