From: Dominik Stadler Date: Sun, 26 Aug 2018 11:41:31 +0000 (+0000) Subject: Set locale provider to JRE,CLDR for tests to have compatible date formatting in JDK 9+ X-Git-Tag: REL_4_0_0_FINAL~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=636d9495a52686df0f570db57d56a72f12274e3c;p=poi.git Set locale provider to JRE,CLDR for tests to have compatible date formatting in JDK 9+ git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1839199 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/build.gradle b/build.gradle index c3497c532e..2ce5f83711 100644 --- a/build.gradle +++ b/build.gradle @@ -138,6 +138,9 @@ subprojects { systemProperties['user.dir'] = workingDir systemProperties['POI.testdata.path'] = '../../test-data' + + // this is necessary for JDK 9+ to keep formatting dates the same way as in previous JDK-versions + systemProperties['java.locale.providers'] = 'JRE,CLDR' } jacoco { diff --git a/src/testcases/org/apache/poi/ss/usermodel/TestExcelStyleDateFormatter.java b/src/testcases/org/apache/poi/ss/usermodel/TestExcelStyleDateFormatter.java index ef23f36ae4..f4e61801a5 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/TestExcelStyleDateFormatter.java +++ b/src/testcases/org/apache/poi/ss/usermodel/TestExcelStyleDateFormatter.java @@ -69,7 +69,8 @@ public class TestExcelStyleDateFormatter { new StringBuffer(), new FieldPosition(java.text.DateFormat.MONTH_FIELD)).toString(); //System.err.println(result + " - " + getUnicode(result.charAt(0))); - assertEquals("Failed for locale " + locale + " and date " + testDates.get(i) + ", having: " + result, + assertEquals("Failed for locale " + locale + ", provider: " + System.getProperty("java.locale.providers") + + " and date " + testDates.get(i) + ", having: " + result, getUnicode(testMap.get(locale).get(i).charAt(0)), getUnicode(result.charAt(0))); } }