Skip to content

Commit d060d5a

Browse files
tastybentoclaude
andcommitted
test: don't assert filesystem order in LocalesManagerTest.testGetAvailableLocales
The unsorted getAvailableLocales(false) list comes from File.listFiles(), whose order is not guaranteed and varies by OS/filesystem. The test asserted fr_FR was first, which failed on CI where en_US is listed first. Assert that both locales are present (size + contains) instead, and keep the deterministic ordering assertions for the sorted list. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7b9cf12 commit d060d5a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/test/java/world/bentobox/bentobox/managers/LocalesManagerTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,13 @@ void testGetAvailableLocales() throws IOException {
229229
makeFakeLocaleFile();
230230
LocalesManager lm = new LocalesManager(plugin);
231231

232-
// Unsorted
232+
// Unsorted - only verify both locales are present, not their order. The unsorted order
233+
// comes from File.listFiles(), which is not guaranteed and varies by OS/filesystem.
233234
List<Locale> localeList = lm.getAvailableLocales(false);
234-
assertEquals(Locale.FRANCE, localeList.getFirst());
235-
assertEquals(Locale.US, localeList.get(1));
236-
// Sorted
235+
assertEquals(2, localeList.size());
236+
assertTrue(localeList.contains(Locale.FRANCE));
237+
assertTrue(localeList.contains(Locale.US));
238+
// Sorted - order is deterministic, the en-US default comes first
237239
localeList = lm.getAvailableLocales(true);
238240
assertEquals(Locale.US, localeList.getFirst());
239241
assertEquals(Locale.FRANCE, localeList.get(1));

0 commit comments

Comments
 (0)