class ExceptionThrowingItemReaderProxy<T> implements ItemReader<T> {

	private int counter = 0;

	private int throwExceptionOnRecordNumber = 4;

	private ItemReader<T> delegate;

	/**
	 * @param throwExceptionOnRecordNumber The number of record on which exception should
	 * be thrown
	 */
	public void setThrowExceptionOnRecordNumber(int throwExceptionOnRecordNumber) {
		this.throwExceptionOnRecordNumber = throwExceptionOnRecordNumber;
	}

	@Nullable
	@Override
	public T read() throws Exception {<FILL_FUNCTION_BODY>}

	public void setDelegate(ItemReader<T> delegate) {
		this.delegate = delegate;
	}

}


		counter++;
		if (counter == throwExceptionOnRecordNumber) {
			throw new UnexpectedJobExecutionException("Planned failure on count=" + counter);
		}

		return delegate.read();
	
<no_super_class>