ChainedListener implements InstrumentedContext.Listener { @Override public void status(TaskId taskId, Phase phase) { guardedCall(() -> first.status(taskId, phase)); guardedCall(() -> second.status(taskId, phase)); } ChainedListener(InstrumentedContext.Listener first,
                  InstrumentedContext.Listener second,
                  Logger logger); @Override void task(Task<?> task); @Override void status(TaskId taskId, Phase phase); @Override void meta(TaskId taskId, Map<String, String> data); @Override void close();  }
@Test public void testStatus() throws Exception { sut.status(task.id(), Phase.START); verify(first).status(task.id(), Phase.START); verify(second).status(task.id(), Phase.START); }
@Test public void testHandlesExceptionOnStatus() throws Exception { RuntimeException exception = new RuntimeException(); doThrow(exception).when(first).status(any(), any()); sut.status(task.id(), Phase.START); verify(logger).warn("Exception", exception); verify(second).status(task.id(), Phase.START); }