DefaultWorldpayBankConfigurationLookupService implements WorldpayBankConfigurationLookupService { @Override public WorldpayBankConfigurationModel getBankConfigurationForBankCode(final String bankCode) { if (isBlank(bankCode)) { return null; } final List<WorldpayBankConfigurationModel> bankList = worldpayBankConfigurationGenericDao.find(ImmutableMap.of(WorldpayBankConfigurationModel.CODE, bankCode)); return bankList.get(0); }  @Override List<WorldpayBankConfigurationModel> getActiveBankConfigurationsForCode(final String apmCode); @Override WorldpayBankConfigurationModel getBankConfigurationForBankCode(final String bankCode); @Required void setApmConfigurationLookupService(final APMConfigurationLookupService apmConfigurationLookupService); @Required void setWorldpayBankConfigurationGenericDao(final GenericDao<WorldpayBankConfigurationModel> worldpayBankConfigurationGenericDao);  }
@Test public void shouldReturnNullIfBankCodeNull() { final WorldpayBankConfigurationModel result = testObj.getBankConfigurationForBankCode(null); assertNull(result); }
@Test public void shouldReturnBankConfigurationIfBankCodeNotNull() { when(worldpayBankConfigurationGenericDaoMock.find(anyMapOf(String.class, Object.class))).thenReturn(singletonList(worldpayBankConfigurationModelMock)); final WorldpayBankConfigurationModel result = testObj.getBankConfigurationForBankCode(BANK_CODE); assertEquals(worldpayBankConfigurationModelMock, result); }