RelaxedFtpConsumer extends FtpConsumerImpl { public void setFailOnDeleteFailure(Boolean b) { failOnDeleteFailure = b; } RelaxedFtpConsumer(); Boolean getFailOnDeleteFailure(); void setFailOnDeleteFailure(Boolean b);  }
@Test public void testSingleFileConsumeDeleteFailsWithExceptionOnFail() throws Exception { setFilesToConsume( new String[] { "/MySingleFile.txt" }, new String[] { "My file payload" }, new long[] { calendarOneYearAgo.getTimeInMillis() } ); consumer.setFailOnDeleteFailure(true); doThrow(new FileTransferException("expected")).when(mockFileTransferClient).delete(anyString()); LifecycleHelper.init(consumer); LifecycleHelper.start(consumer); waitForConsumer(1, 3000); assertEquals(1, messageListener.getMessages().size()); }