### Question:
TimerFilter implements Filter { @Override public Promise<Response, NeverThrowsException> filter(final Context context, final Request request, final Handler next) { final LogTimer timer = logger.getTimer().start(); return delegate.filter(context, request, new Handler() { @Override public Promise<Response, NeverThrowsException> handle(final Context context, final Request request) { timer.pause(); return next.handle(context, request) .thenAlways(new Runnable() { @Override public void run() { timer.resume(); } }); } }).thenAlways(new Runnable() { @Override public void run() { timer.stop(); } }); } TimerFilter(final Filter delegate, final Logger logger); @Override Promise<Response, NeverThrowsException> filter(final Context context,
                                                          final Request request,
                                                          final Handler next);  }### Answer:
@Test public void shouldLogStartedAndElapsedMessages() throws Exception { TimerFilter time = new TimerFilter(delegate, logger); Context context = new RootContext(); when(delegate.filter(context, null, terminal)) .thenReturn(Promises.<Response, NeverThrowsException>newResultPromise(new Response())); time.filter(context, null, terminal).get(); InOrder inOrder = inOrder(timer, terminal); inOrder.verify(timer).start(); inOrder.verify(timer).pause(); inOrder.verify(terminal).handle(context, null); inOrder.verify(timer).resume(); inOrder.verify(timer).stop(); }