OfframpServiceV2 implements OfframpService { @VisibleForTesting void sendError(Exception exception) { sendEvent(new Error(exception.getMessage())); }  @Override void run(); @Override void close(); @Override void onEvent(String event);  }
@Test public void sendError() throws Exception { Exception exception = new IndexOutOfBoundsException("The reason is what it is!"); doNothing().when(underTest).sendEvent(any()); underTest.sendError(exception); verify(underTest).sendEvent(new Error("The reason is what it is!")); }