public void testProcessFilter() throws Exception {
processor.setFailures("4");
processor.setFilter(true);
ItemProcessListenerStub<String, String> listenerStub = new ItemProcessListenerStub<String, String>();
factory.setListeners(new StepListener[] { listenerStub });
Step step = factory.getObject();
step.execute(stepExecution);
assertEquals(0, stepExecution.getSkipCount());
assertEquals(0, stepExecution.getReadSkipCount());
assertEquals(5, stepExecution.getReadCount());
assertEquals(1, stepExecution.getFilterCount());
assertEquals(0, stepExecution.getRollbackCount());
assertTrue(listenerStub.isFilterEncountered());
// writer skips "4"
assertTrue(reader.getRead().contains("4"));
assertFalse(writer.getWritten().contains("4"));
List<String> expectedOutput = Arrays.asList(StringUtils.commaDelimitedListToStringArray("1,2,3,5"));
assertEquals(expectedOutput, writer.getWritten());
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
assertStepExecutionsAreEqual(stepExecution, repository.getLastStepExecution(jobExecution.getJobInstance(), step
.getName()));
}