### Question:
AbstractDelegatingTask extends AbstractTask<SimpleAggregatingProgressReporter> { @Override public final Void call() throws Exception { internalReporter.setState(ExecutionState.RUNNING); try { doCall(); internalReporter.setState(ExecutionState.COMPLETED); } catch (Exception e) { getReporter().terminateWithFailure(); throw e; } return null; } protected  AbstractDelegatingTask(final String name, final Task task); protected  AbstractDelegatingTask(final String name, final Task task, final int ticks); @Override final Void call(); @Override String toString();  }### Answer:
@Test public void testExecutionOfDelegateTask() throws Exception { Task delegate = TaskTestUtil.createMockTask(); Task parent = new AbstractDelegatingTask(PARENT_NAME, delegate) { }; parent.call(); EasyMock.verify(delegate); }
@Test public void testHandlingOfException() throws Exception { Task delegate = TaskTestUtil.createMockTask(); Task parent = new AbstractDelegatingTask(PARENT_NAME, delegate) { @Override protected void doCall() { throw new RuntimeException(); } }; AtomicReference<ProgressReport> lastReportHolder = new AtomicReference<ProgressReport>(); parent.addListener(TaskTestUtil.createLastReportTrackingListener(lastReportHolder)); boolean exceptionThrown = false; try { parent.call(); } catch (RuntimeException e) { exceptionThrown = true; } AssertJUnit.assertEquals(ExecutionState.FAILED, lastReportHolder.get().getState()); AssertJUnit.assertTrue(exceptionThrown); }