RFR: 8265828: [TestBug] Save and restore the default Locale in javafx.base unit test LocalDateTimeStringConverterTest

Kevin Rushforth kcr at openjdk.org
Fri Nov 18 17:23:11 UTC 2022


On Fri, 18 Nov 2022 17:10:04 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

>> That is a fair point.
>> 
>> I'll have to change the code a bit, as `implementations()` method is called before a `@BeforeClass`-tagged method (which is probably why originally `Locale.setDefault()` was called there) and `aFormatter`/`aParser` are already used there, expected to be initialized.
>
> Maybe JUnit5 can help you here. 
> You can check out my recently merged PR for an example for the usage of the parameterized api introduced in JUnit5.
> https://github.com/openjdk/jfx/pull/936

I guess they fixed this rather irritating "feature" in JUnit5. Another, possibly less-intrusive, approach would be to initialize all of the static fields in a `static { ... }` block (with a comment as to why you can't use an `@BeforeClass` method.

-------------

PR: https://git.openjdk.org/jfx/pull/954


More information about the openjfx-dev mailing list