From 80fe417206fa669bf3db80f05fbca7f02735c731 Mon Sep 17 00:00:00 2001 From: Oliver Milke Date: Wed, 10 May 2017 13:56:13 +0200 Subject: [PATCH] fixing test execution on german / windows machines --- .../test/java/sonia/scm/i18n/I18nMessagesTest.java | 11 +++++++++++ .../src/main/java/sonia/scm/AbstractTestBase.java | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/scm-core/src/test/java/sonia/scm/i18n/I18nMessagesTest.java b/scm-core/src/test/java/sonia/scm/i18n/I18nMessagesTest.java index 0760c4efb6..1e317ff62e 100644 --- a/scm-core/src/test/java/sonia/scm/i18n/I18nMessagesTest.java +++ b/scm-core/src/test/java/sonia/scm/i18n/I18nMessagesTest.java @@ -58,6 +58,17 @@ public class I18nMessagesTest @Test public void testI18n() { + /* + lookup-order for this test: + - TM_en (es specified, but not ava) + - TM_ + - TM + + This means that, if there is no default locale specified, this test accidentally passes on non-german machines, an fails on german machines, since the execution locale is de_DE, which is checked even before the fallback locale is considered. + */ + + Locale.setDefault(Locale.ENGLISH); + TestMessages msg = I18nMessages.get(TestMessages.class); assertEquals("Normal Key", msg.normalKey); diff --git a/scm-test/src/main/java/sonia/scm/AbstractTestBase.java b/scm-test/src/main/java/sonia/scm/AbstractTestBase.java index 47ee59b075..13cde0391e 100644 --- a/scm-test/src/main/java/sonia/scm/AbstractTestBase.java +++ b/scm-test/src/main/java/sonia/scm/AbstractTestBase.java @@ -55,7 +55,9 @@ import static org.junit.Assert.*; import java.io.File; +import java.io.IOException; import java.util.UUID; +import java.util.logging.Logger; /** * @@ -155,7 +157,11 @@ public class AbstractTestBase } finally { - IOUtil.delete(tempDirectory); + try { + IOUtil.delete(tempDirectory); + } catch (IOException e) { + Logger.getGlobal().warning(String.format("deleting temp <%s> failed: %s", tempDirectory.getAbsolutePath(), e.getMessage())); + } } }