### Question:
SpringProfilesInitializer implements InitializingBean, ApplicationContextAware { protected String[] getConfiguredProfiles() { List<String> profileNames = new ArrayList<>(); if (forwarderProperties.isDatabaseEnabled()) { profileNames.add(JDBC_DB); } if (forwarderProperties.isGearmanEnabled()) { profileNames.add(GEARMAN); } if (forwarderProperties.isIcinga2Enabled()) { profileNames.add(INCINGA2); } if (forwarderProperties.isCheckMKEnabled()) { profileNames.add(CHECK_MK); } if (forwarderProperties.isJsonEnabled()) { profileNames.add(JSON); } if (cipherProperties.isEncryptionModeEnv()) { profileNames.add(CIPHER_ENV); } else if (cipherProperties.isEncryptionModeInterface()) { profileNames.add(CIPHER_INTERFACE); } return profileNames.toArray(new String[profileNames.size()]); }  void setApplicationContext(ApplicationContext ac); void afterPropertiesSet(); static final String JDBC_DB; static final String GEARMAN; static final String INCINGA2; static final String CHECK_MK; static final String JSON; static final String CIPHER_INTERFACE; static final String CIPHER_ENV; }### Answer:
@Test(dataProvider = "profileNames") public void testGetConfiguredProfiles(boolean database, boolean gearman, String[] expectedStrings) throws Exception { MockitoAnnotations.initMocks(this); when(forwarderProperties.isDatabaseEnabled()).thenReturn(database); when(forwarderProperties.isGearmanEnabled()).thenReturn(gearman); assertEquals(expectedStrings, testling.getConfiguredProfiles()); }
@Test public void testCipherEnv() throws Exception { MockitoAnnotations.initMocks(this); when(cipherProperties.isEncryptionModeEnv()).thenReturn(true); when(cipherProperties.isEncryptionModeInterface()).thenReturn(true); assertEquals(new String[]{SpringProfilesInitializer.CIPHER_ENV}, testling.getConfiguredProfiles()); }
@Test public void testCipherInterface() throws Exception { MockitoAnnotations.initMocks(this); when(cipherProperties.isEncryptionModeEnv()).thenReturn(false); when(cipherProperties.isEncryptionModeInterface()).thenReturn(true); assertEquals(new String[]{SpringProfilesInitializer.CIPHER_INTERFACE}, testling.getConfiguredProfiles()); }