}
@Test
public void testMakeCustomProfileThenDeleteIt()
{
JITWatchConfig config = new JITWatchConfig(new File(testConfigFilename));
String foo = "foo";
List<String> sourcesListFoo = new ArrayList<String>();
sourcesListFoo.add(foo);
config.setSourceLocations(sourcesListFoo);
config.marshalConfigToProperties();
config.savePropertiesToFile();
config = new JITWatchConfig(new File(testConfigFilename));
List<String> retrievedSourcesList = config.getSourceLocations();
assertEquals(1, retrievedSourcesList.size());
assertTrue(retrievedSourcesList.contains(foo));
Set<String> configNames = config.getProfileNames();
assertEquals(2, configNames.size());
assertTrue(configNames.contains(JITWatchConstants.S_PROFILE_DEFAULT));
assertTrue(configNames.contains(JITWatchConstants.S_PROFILE_SANDBOX));
String customProfileName = "Spaceship";
config.setProfileName(customProfileName);
List<String> retrievedSourcesList2 = config.getSourceLocations();
assertEquals(0, retrievedSourcesList2.size());
String bar = "bar";
List<String> sourcesListBar = new ArrayList<String>();
sourcesListBar.add(bar);
config.setSourceLocations(sourcesListBar);
config.saveConfig();
assertEquals(customProfileName, config.getProfileName());
configNames = config.getProfileNames();
assertEquals(3, configNames.size());
assertTrue(configNames.contains(JITWatchConstants.S_PROFILE_DEFAULT));
assertTrue(configNames.contains(JITWatchConstants.S_PROFILE_SANDBOX));
assertTrue(configNames.contains(customProfileName));
config.deleteProfile(customProfileName);
configNames = config.getProfileNames();
assertEquals(2, configNames.size());
assertTrue(configNames.contains(JITWatchConstants.S_PROFILE_DEFAULT));
assertTrue(configNames.contains(JITWatchConstants.S_PROFILE_SANDBOX));
assertFalse(configNames.contains(customProfileName));
assertEquals(JITWatchConstants.S_PROFILE_DEFAULT, config.getProfileName());
retrievedSourcesList = config.getSourceLocations();
assertEquals(1, retrievedSourcesList.size());
assertTrue(retrievedSourcesList.contains(foo));
}