@Test
void shouldUseDelegateToCreateListener() {

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