Use UTF-8 encoding to write test files Align the write of test files with the read encoding to make sure that tests on special chars are consistent. Change-Id: I6b76347a44ecff8c4d170b6979881ff024378c26
diff --git a/src/test/scala/com/gerritforge/analytics/GerritAnalyticsTransformationsSpec.scala b/src/test/scala/com/gerritforge/analytics/GerritAnalyticsTransformationsSpec.scala index a52b89c..0e4c1dd 100644 --- a/src/test/scala/com/gerritforge/analytics/GerritAnalyticsTransformationsSpec.scala +++ b/src/test/scala/com/gerritforge/analytics/GerritAnalyticsTransformationsSpec.scala
@@ -14,7 +14,8 @@ package com.gerritforge.analytics -import java.io.{File, FileWriter} +import java.io.{File, FileOutputStream, FileWriter, OutputStreamWriter} +import java.nio.charset.StandardCharsets import com.gerritforge.analytics.engine.GerritAnalyticsTransformations._ import com.gerritforge.analytics.model.{GerritProject, GerritProjectsSupport, ProjectContributionSource} @@ -311,7 +312,7 @@ val tmpFile = File.createTempFile(System.getProperty("java.io.tmpdir"), s"${getClass.getName}-${System.nanoTime()}") - val out = new FileWriter(tmpFile) + val out = new OutputStreamWriter(new FileOutputStream(tmpFile), StandardCharsets.UTF_8) contributorsJson.foreach(json => out.write(compact(render(json)) + '\n')) out.close tmpFile.toURI.toString