aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2018-11-18 00:49:54 +0000
committerAndreas Beeker <kiwiwings@apache.org>2018-11-18 00:49:54 +0000
commit7239d7c5257dc7d8256f63234806615bdade0b78 (patch)
treebd218c3dcee83bde94564b7d7ddf41bf1bbeef4e
parentc7cf08b50a2caebfa9f8cb60494e01e228bf5088 (diff)
downloadpoi-7239d7c5257dc7d8256f63234806615bdade0b78.tar.gz
poi-7239d7c5257dc7d8256f63234806615bdade0b78.zip
#62921 - Provide OOXMLLite alternative for Java 12+
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1846811 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/TestExcelStyleDateFormatter.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/TestExcelStyleDateFormatter.java b/src/testcases/org/apache/poi/ss/usermodel/TestExcelStyleDateFormatter.java
index f055d4174b..b7fd43e367 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/TestExcelStyleDateFormatter.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/TestExcelStyleDateFormatter.java
@@ -75,7 +75,7 @@ public class TestExcelStyleDateFormatter {
String msg = "Failed testDates for locale " + locale + ", provider: " + provider +
" and date " + d + ", having: " + result;
- int actIdx = (Locale.CHINESE.equals(locale) && jreVersion >= 12) ? 1 : 0;
+ int actIdx = localeIndex(locale);
assertNotNull(msg, result);
assertTrue(msg, result.length() > actIdx);
@@ -85,6 +85,18 @@ public class TestExcelStyleDateFormatter {
}
}
+ /**
+ * Depending on the JRE version, the provider setting and the locale, a different result
+ * is expected and selected via an index
+ */
+ private int localeIndex(Locale locale) {
+ final String provider = System.getProperty("java.locale.providers");
+ return jreVersion < 12 ||
+ !locale.equals (Locale.CHINESE) ||
+ (provider != null && provider.startsWith("JRE"))
+ ? 0 : 1;
+ }
+
private Date parseDate(String dateStr) {
try {
return DATE_FORMAT.parse(dateStr);
@@ -110,9 +122,10 @@ public class TestExcelStyleDateFormatter {
testMap.put(new Locale("ru", "RU"),
"\u044f\u0444\u043c\u0430\u043c\u0438\u0438\u0430\u0441\u043e\u043d\u0434");
- testMap.put(Locale.CHINESE, jreVersion < 12
- ? "\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u5341\u5341"
- : "123456789111");
+ testMap.put(Locale.CHINESE, new String[]{
+ "\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u5341\u5341",
+ "123456789111"
+ }[localeIndex(Locale.CHINESE)]);
testMap.put(new Locale("tr", "TR"),
"\u004f\u015e\u004d\u004e\u004d\u0048\u0054\u0041\u0045\u0045\u004b\u0041");