Fix templatesuite.TemplateTestCase to ensure that configuration settings don't depend on the machine that runs the tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/7a94e59d Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/7a94e59d Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/7a94e59d Branch: refs/heads/2.3 Commit: 7a94e59d908942ac8e7322dbea0986c7e5ca93cc Parents: 252f3c3 Author: ddekany <ddek...@apache.org> Authored: Mon Jan 22 15:37:08 2018 +0100 Committer: ddekany <ddek...@apache.org> Committed: Mon Jan 22 15:37:08 2018 +0100 ---------------------------------------------------------------------- .../java/freemarker/test/templatesuite/TemplateTestCase.java | 7 +++++++ 1 file changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7a94e59d/src/test/java/freemarker/test/templatesuite/TemplateTestCase.java ---------------------------------------------------------------------- diff --git a/src/test/java/freemarker/test/templatesuite/TemplateTestCase.java b/src/test/java/freemarker/test/templatesuite/TemplateTestCase.java index 63a7203..ba418dd 100644 --- a/src/test/java/freemarker/test/templatesuite/TemplateTestCase.java +++ b/src/test/java/freemarker/test/templatesuite/TemplateTestCase.java @@ -25,6 +25,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.math.BigDecimal; import java.math.BigInteger; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; @@ -32,6 +33,7 @@ import java.util.GregorianCalendar; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.ResourceBundle; import java.util.Set; @@ -137,6 +139,11 @@ public class TemplateTestCase extends FileTestCase { this.noOutput = noOutput; conf = new Configuration(incompatibleImprovements); + + // Ensure that the configuration settings don't depend on the machine that runs the test: + conf.setLocale(Locale.US); + conf.setDefaultEncoding(StandardCharsets.UTF_8.name()); + conf.setTimeZone(TimeZone.getTimeZone("GMT+1")); } public void setSetting(String param, String value) throws IOException {