RFR: 8265828: [TestBug] Save and restore the default Locale in javafx.base unit test LocalDateTimeStringConverterTest
Lukasz Kostyra
duke at openjdk.org
Fri Nov 18 17:02:42 UTC 2022
On Fri, 18 Nov 2022 16:50:21 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> The change moves Locale setting in the test to `@BeforeClass` and `@AfterClass` calls. `@BeforeClass` method call stores current default VM locale and applies Locale.US, while `@AfterClass` method restores old VM locale after all tests are completed.
>>
>> I tested it both on Mac and Windows, in both cases Locale is changed, restored properly and tests pass.
>
> modules/javafx.base/src/test/java/test/javafx/util/converter/LocalDateTimeStringConverterTest.java line 60:
>
>> 58: private static final DateTimeFormatter aFormatter = DateTimeFormatter.ofPattern("dd MM yyyy HH mm ss");
>> 59: private static final DateTimeFormatter aParser = DateTimeFormatter.ofPattern("yyyy MM dd hh mm ss a");
>> 60: private static Locale oldLocale;
>
> I wonder how many other tests we have that depend on specific Locale? Perhaps we need to apply the same treatment to:
> - LocalDateStringConverterTest
> - LocalTimeStringConverterTest
I could also change those, as they use `DateTimeFormatter` as well which uses `Locale` underneath as discussed above. @kevinrushforth what do you think?
-------------
PR: https://git.openjdk.org/jfx/pull/954
More information about the openjfx-dev
mailing list