Configurator { public void saveConfiguration() throws IOException { saver.save(properties); } Configurator();  Configurator(Properties properties); void saveConfiguration(); void setApplicationNameTo(String name); void toggleFixedVersion(); void toggleLatestVersion(); void changeFixedVersionLocationTo(String location); void toggleHttpRepositoryForLatestVersion(); void toggleFileRepositoryForLatestVersion(); void setRepositoryLocationForLatestVersionTo(String location);  }
@Test public void startsWithEmptyProperties() throws Exception { new Configurator().saveConfiguration(); String content = FileUtils.readFileToString(new File(".", "update.properties")); assertThat(content, is(not(containsString("=")))); }
@Test public void writesConfigurationToUpdatePropertiesInWorkingDirectory() throws Exception { configurator.saveConfiguration(); assertThat(propertiesFile.exists(), is(true)); }
@Test public void closesStreamAfterWriting() throws Exception { configurator.saveConfiguration(); propertiesFile.delete(); assertThat(propertiesFile.exists(), is(false)); }