Skip to content

Commit 5d52d11

Browse files
committed
🧪 Fixed test that failed on Linux
Using what is essentially the same code in the test as what is being tested is not ideal, but it works around the difference in behaviours by the Path object on different platforms. This relates to issue #32.
1 parent cf1a6e3 commit 5d52d11

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎fluentforms/core/src/test/java/com/_4point/aem/fluentforms/api/PathOrUrlTest.java‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,14 @@ void test_convertRelativePathToRelativeUrl_Abs() throws Exception {
314314
}
315315

316316
@ParameterizedTest
317-
@CsvSource( { "C:/foo/bar,C:/foo/bar", "foo,foo", "foo/bar,foo/bar", "C:\\foo\\bar,C:/foo/bar", "\\\\foo\\bar,//foo/bar/", "C:/foo/bar/,C:/foo/bar", "\\\\foo\\bar\\,//foo/bar/" })
318-
void testToUnixString(String path, String expected) {
319-
PathOrUrl result = PathOrUrl.from(Path.of(path));
317+
@ValueSource(strings = { "C:/foo/bar", "foo", "foo/bar", "C:\\foo\\bar", "\\\\foo\\bar", "C:/foo/bar/", "\\\\foo\\bar\\" })
318+
void testToUnixString(String path) {
319+
Path pathPath = Path.of(path);
320+
PathOrUrl result = PathOrUrl.from(pathPath);
320321
assertTrue(result.isPath(), "Expected that isPath() would be true");
321322
assertFalse(result.isUrl(), "Expected that isUrl() would be false");
322323
assertFalse(result.isCrxUrl(), "Expected that isCrxUrl() would be false");
323-
// Path expected = Paths.get(path);
324+
String expected = pathPath.toString().replace('\\', '/');
324325
assertEquals(expected, result.toUnixString());
325326
}
326327

0 commit comments

Comments
 (0)