Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Restore initial locale at the end of a JUnit test case which modify it.
lucciomand41ad7af6f8e
diff --git a/test/java/net/yacy/document/TextParserTest.java b/test/java/net/yacy/document/TextParserTest.javaindex 2d874d592..6600216f2 100644--- a/test/java/net/yacy/document/TextParserTest.java+++ b/test/java/net/yacy/document/TextParserTest.java@@ -44,11 +44,20 @@ public class TextParserTest {*/@Testpublic void testSupportsMimeLocaleConsistency() {- for (Locale locale : Locale.getAvailableLocales()) {- Locale.setDefault(locale);- for (String mimeType : TextParser.supportedMimeTypes()) {- assertNull(locale + " " + mimeType, TextParser.supportsMime(mimeType.toUpperCase(Locale.ROOT)));+ Locale initialDefaultLocale = Locale.getDefault();+ try {+ for (Locale locale : Locale.getAvailableLocales()) {+ Locale.setDefault(locale);+ for (String mimeType : TextParser.supportedMimeTypes()) {+ assertNull(locale + " " + mimeType, TextParser.supportsMime(mimeType.toUpperCase(Locale.ROOT)));+ }}+ } finally {+ /*+ * Restore the initial default locale to prevent side-effects on other JUnit+ * tests run in the same session+ */+ Locale.setDefault(initialDefaultLocale);}}