@Test
void writeProperties_preserve_order() throws IOException, URISyntaxException {

    // set up a temp file with the current contents
    setupCurrentFile(TEST_PROPERTIES, PROPERTIES);
    final Properties properties = new Properties();
    properties.putAll(ImmutableMap.of("key1", "value1", "key2", "value2"));
    WriterHelper.writePropertiesFile(testProjectDir, documentFileUtils, properties, TEST_PROPERTIES);
    // check file existing and permissions
    final File propertiesFile = checkFileBasics(WriterHelperTest.TEST_PROPERTIES, PROPERTIES);
    // load existing file
    final List<String> lines = readLines(propertiesFile, StandardCharsets.ISO_8859_1);
    // ensure ordering
    assertEquals(4, lines.size());
    assertTrue(lines.get(0).startsWith("key1"));
    assertTrue(lines.get(1).startsWith("key3"));
    assertTrue(lines.get(2).startsWith("key4"));
    assertTrue(lines.get(3).startsWith("key2"));
}