Utils { static void writeProperties(File outputFile, Properties p) { try (OutputStream output = new FileOutputStream(outputFile)) { p.store(output, "Generated by sonar-runner"); } catch (Exception e) { throw new IllegalStateException("Fail to export sonar-runner properties", e); } } private  Utils(); static Properties loadEnvironmentProperties(Map<String, String> env); static void deleteQuietly(Path f);  }
@Test public void write_properties() throws IOException { File f = temp.newFile(); Properties p = new Properties(); p.put("key", "value"); Utils.writeProperties(f, p); assertThat(Files.readAllLines(f.toPath(), StandardCharsets.UTF_8)).contains("key=value"); }