@SuppressWarnings("unchecked")
@Test
public void runAndExecuteFiniteSpout() throws Exception {

	final FiniteSpout stormSpout = mock(FiniteSpout.class);
	when(stormSpout.reachedEnd()).thenReturn(false, false, false, true, false, false, true);
	final StreamingRuntimeContext taskContext = mock(StreamingRuntimeContext.class);
	when(taskContext.getExecutionConfig()).thenReturn(mock(ExecutionConfig.class));
	when(taskContext.getTaskName()).thenReturn("name");
	final SpoutWrapper<?> wrapper = new SpoutWrapper<Object>(stormSpout);
	wrapper.setRuntimeContext(taskContext);
	wrapper.run(mock(SourceContext.class));
	verify(stormSpout, times(3)).nextTuple();
}