@Test
public void shouldCacheDataSourceOnceLookedUp() throws Exception {

    final String jndiName = "jndiName";
    final DataSource dataSource = mock(DataSource.class);
    when(initialContext.lookup(jndiName)).thenReturn(dataSource);
    assertThat(defaultJdbcDataSourceProvider.getDataSource(jndiName), is(dataSource));
    assertThat(defaultJdbcDataSourceProvider.getDataSource(jndiName), is(dataSource));
    assertThat(defaultJdbcDataSourceProvider.getDataSource(jndiName), is(dataSource));
    assertThat(defaultJdbcDataSourceProvider.getDataSource(jndiName), is(dataSource));
    assertThat(defaultJdbcDataSourceProvider.getDataSource(jndiName), is(dataSource));
    assertThat(defaultJdbcDataSourceProvider.getDataSource(jndiName), is(dataSource));
    assertThat(defaultJdbcDataSourceProvider.getDataSource(jndiName), is(dataSource));
    verify(initialContext, times(1)).lookup(jndiName);
}