Anonymous committed 513d12e

Fixing Unit tests for Locale being de_DE, or fr_FR


Comments (0)

Files changed (1)


         // This tests will try to load bundles from the 3 locales but we only have files for France and Germany.
         // Before this fix loading the bundle for Germany failed since Italy have previously failed and thus the misses cache
         // contained a false entry
+        // Set default Locale to Locale.US
+        Locale defaultLocale = Locale.getDefault();
+        Locale.setDefault(Locale.US);
         ResourceBundle rbFrance = LocalizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.FRANCE);
         ResourceBundle rbItaly = LocalizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.ITALY);
         ResourceBundle rbGermany = LocalizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.GERMANY);
+        // Reset to previous default Locale
+        Locale.setDefault(defaultLocale);
         assertEquals("Bonjour", rbFrance.getString("hello"));