DefaultWorldpayBankConfigurationLookupService implements WorldpayBankConfigurationLookupService { @Override public List<WorldpayBankConfigurationModel> getActiveBankConfigurationsForCode(final String apmCode) { final WorldpayAPMConfigurationModel apmConfigurationForCode = apmConfigurationLookupService.getAPMConfigurationForCode(apmCode); final Map<String, Object> queryParams = new HashMap<>(); queryParams.put(WorldpayBankConfigurationModel.APM, apmConfigurationForCode); queryParams.put(WorldpayBankConfigurationModel.ACTIVE, Boolean.TRUE); return worldpayBankConfigurationGenericDao.find(queryParams); }  @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 testGetActiveBankConfigurationsForCode() { when(apmConfigurationLookupService.getAPMConfigurationForCode(APM_CODE)).thenReturn(apmConfigurationModelMock); when(worldpayBankConfigurationGenericDaoMock.find(anyMapOf(String.class, Object.class))).thenReturn(singletonList(worldpayBankConfigurationModelMock)); final List<WorldpayBankConfigurationModel> activeBankConfigurationsForCode = testObj.getActiveBankConfigurationsForCode(APM_CODE); verify(worldpayBankConfigurationGenericDaoMock).find(mapArgumentCaptor.capture()); final Map<String, Object> value = mapArgumentCaptor.getValue(); assertEquals(apmConfigurationModelMock, value.get(WorldpayBankConfiguration.APM)); assertEquals(Boolean.TRUE, value.get(WorldpayBankConfiguration.ACTIVE)); assertTrue(activeBankConfigurationsForCode.contains(worldpayBankConfigurationModelMock)); }