mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-01-24 00:01:44 +01:00
Make unit tests in LocaleFileManagerTest deterministic
The order in which files inside of a given directory are listed is not guaranteed in any way. This causes tests to work on my machine but fail on out GitHub Actions CI/CD pipeline.
This commit is contained in:
parent
6c6c3e950c
commit
67a69e34e8
@ -14,6 +14,8 @@ import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@ -55,7 +57,8 @@ class LocaleFileManagerTest {
|
||||
|
||||
String[] localeFiles = plugin.getDataFolder().list();
|
||||
Assertions.assertNotNull(localeFiles);
|
||||
Assertions.assertArrayEquals(new String[] {"en.yml", "en_US.lang", "de.txt"}, localeFiles);
|
||||
Arrays.sort(localeFiles);
|
||||
Assertions.assertArrayEquals(new String[] {"de.txt", "en.yml", "en_US.lang"}, localeFiles);
|
||||
|
||||
Assertions.assertSame(4, httpClient.callsOnGet.size());
|
||||
Assertions.assertTrue(httpClient.callsOnGet.get(0).contains("/test/_index.txt"));
|
||||
@ -85,7 +88,8 @@ class LocaleFileManagerTest {
|
||||
String[] localeFiles = plugin.getDataFolder().list();
|
||||
|
||||
Assertions.assertNotNull(localeFiles);
|
||||
Assertions.assertArrayEquals(new String[] {"en.yml", "en_US.lang", "fr.lang", "de.txt"}, localeFiles);
|
||||
Arrays.sort(localeFiles);
|
||||
Assertions.assertArrayEquals(new String[] {"de.txt", "en.yml", "en_US.lang", "fr.lang"}, localeFiles);
|
||||
|
||||
Assertions.assertSame(3, httpClient.callsOnGet.size());
|
||||
Assertions.assertTrue(httpClient.callsOnGet.get(0).contains("/test/_index.txt"));
|
||||
|
Loading…
Reference in New Issue
Block a user