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

	final SetupOutputFieldsDeclarer declarer = new SetupOutputFieldsDeclarer();
	declarer.declare(new Fields("dummy"));
	PowerMockito.whenNew(SetupOutputFieldsDeclarer.class).withNoArguments()
			.thenReturn(declarer);
	final StreamingRuntimeContext taskContext = mock(StreamingRuntimeContext.class);
	when(taskContext.getExecutionConfig()).thenReturn(mock(ExecutionConfig.class));
	when(taskContext.getTaskName()).thenReturn("name");
	final IRichSpout spout = mock(IRichSpout.class);
	final int numberOfCalls = this.r.nextInt(50);
	final SpoutWrapper<?> spoutWrapper = new SpoutWrapper<Object>(spout,
			numberOfCalls);
	spoutWrapper.setRuntimeContext(taskContext);
	spoutWrapper.run(mock(SourceContext.class));
	verify(spout, times(numberOfCalls)).nextTuple();
}