RequestHandlerImpl implements RequestHandler { public void handleRequest() { logRequestStart(); requestFulfiller.fulfillRequest(this::onRequestFulfilled); } RequestHandlerImpl(
      SocketHolder socketHolder,
      RequestFulfiller requestFulfiller,
      String logTag,
      String requestStartMessage); void handleRequest();  }
@Test public void logsRequestStart() { testSubject.handleRequest(); PowerMockito.verifyStatic(Logger.class); Logger.logVerbose(logTag, logMessage); }
@Test public void closesSocket() { doAnswer( AdditionalAnswers.answerVoid( (RunnableFunction onRequestFulfilled) -> onRequestFulfilled.run())) .when(requestFulfiller) .fulfillRequest(any()); testSubject.handleRequest(); verify(socketHolder, times(1)).close(logTag); }