@Test
public void testCancel() throws Exception {

	final int numberOfCalls = 5 + this.r.nextInt(5);
	final StreamingRuntimeContext taskContext = mock(StreamingRuntimeContext.class);
	when(taskContext.getExecutionConfig()).thenReturn(mock(ExecutionConfig.class));
	when(taskContext.getTaskName()).thenReturn("name");
	final IRichSpout spout = new FiniteTestSpout(numberOfCalls);
	final SpoutWrapper<Tuple1<Integer>> spoutWrapper = new SpoutWrapper<Tuple1<Integer>>(spout);
	spoutWrapper.setRuntimeContext(taskContext);
	spoutWrapper.cancel();
	final TestContext collector = new TestContext();
	spoutWrapper.run(collector);
	Assert.assertEquals(new LinkedList<Tuple1<Integer>>(), collector.result);
}