@Test
void shouldReuseCompoundListenerFromFactory() {

    SimpleJdbcEventListener listener1 = new SimpleJdbcEventListener() {};
    Mockito.when(delegate.createJdbcEventListener()).thenReturn(new CompoundJdbcEventListener());
    ContextJdbcEventListenerFactory contextJdbcEventListenerFactory = new ContextJdbcEventListenerFactory(delegate, Collections.singletonList(listener1));
    CompoundJdbcEventListener jdbcEventListener = (CompoundJdbcEventListener) contextJdbcEventListenerFactory.createJdbcEventListener();
    assertThat(jdbcEventListener.getEventListeners()).hasSize(1);
    assertThat(jdbcEventListener.getEventListeners()).contains(listener1);
}