### Question:
JdbcExecuteInterceptor implements Installable { @Advice.OnMethodExit(onThrowable = Throwable.class) public static void exit(@Advice.Enter final ServiceRequestEvent requestEvent, @Advice.Return final Object response, @Advice.Thrown final Throwable thrown) { ServiceResponseEvent responseEvent = new ServiceDownstreamResponseEvent( SQL_ORIGIN, requestEvent.getOperation(), requestEvent.getService(), requestEvent) .withResponse(response) .withThrown(thrown); EventBus.publish(responseEvent); }  @Advice.OnMethodEnter static ServiceRequestEvent enter(@Advice.AllArguments final Object[] args,
                                            @Advice.Origin final String origin,
                                            @Advice.This final Statement stmt); @Advice.OnMethodExit(onThrowable = Throwable.class) static void exit(@Advice.Enter final ServiceRequestEvent requestEvent,
                            @Advice.Return final Object response,
                            @Advice.Thrown final Throwable thrown); @Override AgentBuilder install(final AgentBuilder agentBuilder); static String parseQueryFromStatement(Statement stmt, Object[] params); static final Logger log; static final String SQL_ORIGIN; }### Answer:
@Test public void testResponseEventPublish() { JdbcExecuteInterceptor.exit(requestEvent, 1, null); ServiceResponseEvent received = (ServiceResponseEvent) mockListener.getReceivedEvents().get(0); assertEquals(requestEvent, received.getRequest()); assertEquals(1, received.getResponse()); assertNull(received.getThrown()); }
@Test public void testResponseEventWithThrownPublish() { Exception ex = new SQLException(); JdbcExecuteInterceptor.exit(requestEvent, null, ex); ServiceResponseEvent received = (ServiceResponseEvent) mockListener.getReceivedEvents().get(0); assertEquals(requestEvent, received.getRequest()); assertEquals(ex, received.getThrown()); assertNull(received.getResponse()); }