class MethodInvokingTaskletAdapter extends AbstractMethodInvokingDelegator<Object> implements Tasklet {

	@Nullable
	@Override
	public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
		if (getArguments() == null) {
			setArguments(new Object[]{contribution, chunkContext});
		}
		contribution.setExitStatus(mapResult(invokeDelegateMethod()));
		return RepeatStatus.FINISHED;
	}

}

class MethodInvokingTaskletAdapterTest {

	private StepContribution stepContribution;
	private ChunkContext chunkContext;
	private TestTasklet tasklet;
	private MethodInvokingTaskletAdapter adapter;

	@Test
	public void testExactlySameSignature() throws Exception {

		adapter.setTargetMethod("execute");
		RepeatStatus repeatStatus = adapter.execute(stepContribution, chunkContext);
		assertEquals(RepeatStatus.FINISHED, repeatStatus);
		assertEquals(tasklet.getStepContribution(), stepContribution);
		assertEquals(tasklet.getChunkContext(), chunkContext);
	}

}