TaskExecutionContext { public void assertTaskIsLenient(Exception e) throws TaskNonLenientExecutionException { if (!lenient) { throw new TaskNonLenientExecutionException(e); } } TaskExecutionContext(Task<? extends TaskParameters> task, boolean lenient); NotifiableTaskMetadata notifiableTaskMetadata(); @SuppressWarnings("rawtypes") Task task(); void taskStart(); void taskEnded(); long executionTime(); int incrementAndGetOutputDocumentsCounter(); int outputDocumentsCounter(); void assertTaskIsLenient(Exception e); void assertTaskIsLenient(String message);  }
@Test public void lenient() throws TaskExecutionException { TaskExecutionContext victim = new TaskExecutionContext(mock(Task.class), true); victim.assertTaskIsLenient(new Exception("Test")); }
@Test(expected = TaskNonLenientExecutionException.class) public void nonLenient() throws TaskExecutionException { TaskExecutionContext victim = new TaskExecutionContext(mock(Task.class), false); victim.assertTaskIsLenient(new Exception("Test")); }