### Question:
BankProfileReadingService implements ResourceLoaderAware { public ProfileConfigurations getProfileConfigurations() { Map<String, ProfileConfiguration> instanceConfigurations = new HashMap<>(); if (multitenancyEnabled) { customBankProfiles.keySet().forEach(key -> instanceConfigurations.put( key.toLowerCase(), yaml.loadAs(loadProfile(key), ProfileConfiguration.class) )); } ProfileConfiguration singleProfileConfiguration = yaml.loadAs(loadProfile(), ProfileConfiguration.class); return new ProfileConfigurations(multitenancyEnabled, singleProfileConfiguration, instanceConfigurations); } BankProfileReadingService(); @Override void setResourceLoader(ResourceLoader resourceLoader); ProfileConfigurations getProfileConfigurations();  }### Answer:
@Test void profileConfigurationMultitenant() { ReflectionTestUtils.setField(bankProfileReadingService, "multitenancyEnabled", true); Map<String, String> customBankProfiles = new HashMap<>(); customBankProfiles.put("bank1", "classpath:bank_profile_additional_fields.yml"); customBankProfiles.put("bank2", "classpath:bank_profile_additional_fields.yml"); ReflectionTestUtils.setField(bankProfileReadingService, "customBankProfiles", customBankProfiles); ProfileConfigurations profileConfigurations = bankProfileReadingService.getProfileConfigurations(); assertNotNull(profileConfigurations); assertTrue(profileConfigurations.isMultitenancyEnabled()); assertEquals(2, profileConfigurations.getInstanceConfigurations().size()); assertTrue(profileConfigurations.getInstanceConfigurations().containsKey("bank1")); assertTrue(profileConfigurations.getInstanceConfigurations().containsKey("bank2")); }
@Test void profileConfigurationWithAdditionalFields() { ProfileConfigurations defaultConfigurations = bankProfileReadingService.getProfileConfigurations(); ReflectionTestUtils.setField(bankProfileReadingService, "customBankProfile", "classpath:bank_profile_additional_fields.yml"); ProfileConfigurations configurationWithCustomProfile = bankProfileReadingService.getProfileConfigurations(); assertEquals(defaultConfigurations.getSetting(INSTANCE_ID), configurationWithCustomProfile.getSetting(INSTANCE_ID)); }
@Test void profileConfigurationWithoutUsualFields() { ProfileConfigurations defaultConfiguration = bankProfileReadingService.getProfileConfigurations(); ReflectionTestUtils.setField(bankProfileReadingService, "customBankProfile", "classpath:bank_profile_missing_fields.yml"); ProfileConfigurations configurationWithCustomProfile = bankProfileReadingService.getProfileConfigurations(); assertNotEquals(defaultConfiguration.getSetting(INSTANCE_ID), configurationWithCustomProfile.getSetting(INSTANCE_ID)); }
@Test void profileConfigurationScaRedirectFlowOAUTH() { ReflectionTestUtils.setField(bankProfileReadingService, "customBankProfile", "classpath:bank_profile_sca_redirect_flow_oauth.yml"); ProfileConfigurations configurationWithCustomProfile = bankProfileReadingService.getProfileConfigurations(); assertEquals(ScaRedirectFlow.OAUTH, configurationWithCustomProfile.getSetting(INSTANCE_ID).getCommon().getScaRedirectFlow()); }
@Test void profileConfigurationScaRedirectFlowRedirect() { ReflectionTestUtils.setField(bankProfileReadingService, "customBankProfile", "classpath:bank_profile_sca_redirect_flow_redirect.yml"); ProfileConfigurations configurationWithCustomProfile = bankProfileReadingService.getProfileConfigurations(); assertEquals(ScaRedirectFlow.REDIRECT, configurationWithCustomProfile.getSetting(INSTANCE_ID).getCommon().getScaRedirectFlow()); }