@Test public void testLoadClient() { String[] clientNames = {"Client1", "Client2", "Client3"}; for (int i = 0; i < 10; i++) { for (String clientName: clientNames) { DbLoadedSamlClientConfigurationDto cfg = daoUnderTest.loadClient(clientName); assertNotNull(cfg); assertEquals(clientName, cfg.getClientName()); } assertNull(daoUnderTest.loadClient("DoesNotExist")); } verify(realDaoMock, times(0)).loadClientNames(); verify(realDaoMock, times(1)).loadAllClients(); verify(realDaoMock, times(0)).loadClient(anyString()); }
@Override public DbLoadedSamlClientConfigurationDto loadClient(String clientName) { checkAndLoadFromRealDao(); return cachedConfigurations.get(clientName); }
CachingSamlClientDaoImpl implements SamlClientDao { @Override public DbLoadedSamlClientConfigurationDto loadClient(String clientName) { checkAndLoadFromRealDao(); return cachedConfigurations.get(clientName); } }
CachingSamlClientDaoImpl implements SamlClientDao { @Override public DbLoadedSamlClientConfigurationDto loadClient(String clientName) { checkAndLoadFromRealDao(); return cachedConfigurations.get(clientName); } CachingSamlClientDaoImpl(final SamlClientDao realDao); }
CachingSamlClientDaoImpl implements SamlClientDao { @Override public DbLoadedSamlClientConfigurationDto loadClient(String clientName) { checkAndLoadFromRealDao(); return cachedConfigurations.get(clientName); } CachingSamlClientDaoImpl(final SamlClientDao realDao); @Override List<String> loadClientNames(); @Override List<DbLoadedSamlClientConfigurationDto> loadAllClients(); @Override DbLoadedSamlClientConfigurationDto loadClient(String clientName); }
CachingSamlClientDaoImpl implements SamlClientDao { @Override public DbLoadedSamlClientConfigurationDto loadClient(String clientName) { checkAndLoadFromRealDao(); return cachedConfigurations.get(clientName); } CachingSamlClientDaoImpl(final SamlClientDao realDao); @Override List<String> loadClientNames(); @Override List<DbLoadedSamlClientConfigurationDto> loadAllClients(); @Override DbLoadedSamlClientConfigurationDto loadClient(String clientName);  }