Skip to content

Commit edca194

Browse files
tomaszsmyvrudas
authored andcommitted
Fix tests on windows
1 parent 12cee54 commit edca194

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/test/java/ai/elimu/util/csv/CsvLetterExtractionHelperTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
import java.io.File;
1010
import java.io.IOException;
11+
import java.net.URI;
12+
import java.net.URISyntaxException;
1113
import java.net.URL;
1214
import java.nio.file.Files;
1315
import java.nio.file.Paths;
@@ -167,20 +169,18 @@ public void try_extract_letters_for_missing_file() throws Exception {
167169
}
168170

169171
@Test
170-
public void extracted_letter_from_a_test_letters_csv_resource() {
172+
public void extracted_letter_from_a_test_letters_csv_resource() throws URISyntaxException {
171173
String lettersCsvResourcePath = "db/content_TEST/eng/letters.csv";
172174

173-
URL lettersCsvUrl = getClass()
174-
.getClassLoader()
175-
.getResource(lettersCsvResourcePath);
175+
URI lettersCsvUrl = ClassLoader.getSystemResource(lettersCsvResourcePath).toURI();
176176

177177
assertNotNull(
178178
"Test resource with CSV data not found for path: " + lettersCsvResourcePath,
179179
lettersCsvUrl
180180
);
181181

182182
List<Letter> lettersFromCsvBackup = getLettersFromCsvBackup(
183-
Paths.get(lettersCsvUrl.getPath())
183+
Paths.get(lettersCsvUrl)
184184
.toFile()
185185
);
186186

src/test/java/ai/elimu/util/csv/CsvSoundExtractionHelperTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
import java.io.File;
1111
import java.io.IOException;
12+
import java.net.URI;
13+
import java.net.URISyntaxException;
1214
import java.net.URL;
1315
import java.nio.file.Files;
1416
import java.nio.file.Paths;
@@ -214,20 +216,18 @@ public void try_extract_sounds_for_missing_file() throws Exception {
214216
}
215217

216218
@Test
217-
public void extracted_sound_from_a_test_sounds_csv_resource() {
219+
public void extracted_sound_from_a_test_sounds_csv_resource() throws URISyntaxException {
218220
String soundsCsvResourcePath = "db/content_TEST/eng/sounds.csv";
219221

220-
URL soundsCsvUrl = getClass()
221-
.getClassLoader()
222-
.getResource(soundsCsvResourcePath);
222+
URI soundsCsvUrl = ClassLoader.getSystemResource(soundsCsvResourcePath).toURI();
223223

224224
assertNotNull(
225225
"Test resource with CSV data not found for path: " + soundsCsvResourcePath,
226226
soundsCsvUrl
227227
);
228228

229229
List<Sound> soundsFromCsvBackup = getSoundsFromCsvBackup(
230-
Paths.get(soundsCsvUrl.getPath())
230+
Paths.get(soundsCsvUrl)
231231
.toFile()
232232
);
233233

0 commit comments

Comments
 (0)