Skip to content

Commit

Permalink
#131: simplified implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Pfotenhauer committed Aug 28, 2020
1 parent 1fe9c07 commit 45fbe26
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/test/java/com/xceptance/neodymium/tests/NeodymiumTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.xceptance.neodymium.tests;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.text.MessageFormat;
import java.util.ArrayList;
Expand All @@ -11,6 +12,7 @@
import java.util.Map;
import java.util.stream.Collectors;

import org.apache.commons.io.FileUtils;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.runner.Description;
Expand Down Expand Up @@ -105,17 +107,14 @@ public void checkDescription(Class<?> clazz, String[] expectedTestDescription) t
*/
public static void writeMapToPropertiesFile(Map<String, String> map, File file)
{
String propertiesString = map.entrySet().stream()
.map(entry -> entry.getKey() + "=" + entry.getValue())
.collect(Collectors.joining(System.lineSeparator()));
try
{
String propertiesString = map.keySet().stream()
.map(key -> key + "=" + map.get(key))
.collect(Collectors.joining("\r\n"));

FileOutputStream outputStream = new FileOutputStream(file);
outputStream.write(propertiesString.getBytes());
outputStream.close();
FileUtils.writeStringToFile(file, propertiesString, StandardCharsets.UTF_8);
}
catch (Exception e)
catch (IOException e)
{
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 45fbe26

Please sign in to comment.