Copilot commented on code in PR #948:
URL: https://github.com/apache/fesod/pull/948#discussion_r3583708192
##########
fesod-sheet/src/test/java/org/apache/fesod/sheet/util/DateUtilsTest.java:
##########
@@ -194,6 +194,45 @@ void test_format_LocalDate() {
Assertions.assertEquals("2026-10-01", defaultFormatResult2);
}
+ @Test
+ void test_dateTimeFormatterCache_distinguishesRootFromDefaultLocale() {
+ Locale originalLocale = Locale.getDefault(Locale.Category.FORMAT);
+ try {
+ Locale.setDefault(Locale.Category.FORMAT, Locale.FRANCE);
+ LocalDate date = LocalDate.of(2026, 7, 13);
+ String format = "MMMM";
+
+ String rootResult = DateUtils.format(date, format, Locale.ROOT);
+ String defaultResult = DateUtils.format(date, format, null);
+
+
Assertions.assertEquals(date.format(DateTimeFormatter.ofPattern(format,
Locale.ROOT)), rootResult);
+
Assertions.assertEquals(date.format(DateTimeFormatter.ofPattern(format,
Locale.FRANCE)), defaultResult);
+ Assertions.assertNotEquals(rootResult, defaultResult);
+ } finally {
+ Locale.setDefault(Locale.Category.FORMAT, originalLocale);
+ }
+ }
+
+ @Test
+ void test_dateTimeFormatterCache_tracksDefaultFormatLocaleChanges() {
Review Comment:
This test changes the JVM default FORMAT locale (Locale.setDefault), which
affects all threads. Since the repository has JUnit parallel execution enabled,
guard this global mutation with a ResourceLock to avoid future flakiness when
concurrent tests are introduced.
##########
fesod-sheet/src/test/java/org/apache/fesod/sheet/util/DateUtilsTest.java:
##########
@@ -194,6 +194,45 @@ void test_format_LocalDate() {
Assertions.assertEquals("2026-10-01", defaultFormatResult2);
}
+ @Test
+ void test_dateTimeFormatterCache_distinguishesRootFromDefaultLocale() {
Review Comment:
This test mutates the JVM default FORMAT locale (Locale.setDefault), which
is process-wide state. With JUnit parallel execution enabled in the repo, this
can lead to flaky failures if any tests execute concurrently now or in the
future. Add a ResourceLock around the test to prevent concurrent
locale-dependent execution.
##########
fesod-sheet/src/test/java/org/apache/fesod/sheet/util/NumberUtilsTest.java:
##########
@@ -77,6 +92,30 @@ void test_format_withFormat() {
Assertions.assertEquals("123.46", result);
}
+ @Test
+ void test_formatCache_tracksDefaultFormatLocaleChanges() {
Review Comment:
This test changes the JVM default FORMAT locale via Locale.setDefault(...),
which is global mutable state. The project has JUnit parallel execution
enabled, so this can become flaky if any tests are later marked
@Execution(CONCURRENT) or the build enables class-level parallelism. Guard the
locale mutation with a JUnit ResourceLock so locale-dependent tests can’t run
concurrently.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]