mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 19:47:49 +01:00
Fixed parameterized test errors
This commit is contained in:
parent
baab6e5f88
commit
ebffd886fe
@ -47,16 +47,16 @@ class URIPathTest {
|
|||||||
assertEquals(expected, result);
|
assertEquals(expected, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest(name = "URIPath {0} gets part {1}: {2}")
|
||||||
@CsvSource({
|
@CsvSource({
|
||||||
"/", "0", "",
|
"/", "0", " ",
|
||||||
"/example/target", "0", "example",
|
"/example/target", "0", "example",
|
||||||
"/example/target", "1", "target",
|
"/example/target", "1", "target",
|
||||||
"/example/target/", "2", "",
|
"/example/target/", "2", " ",
|
||||||
})
|
})
|
||||||
void partGettingWorksProperly(String targetURI, int partNumber, String expectedPart) {
|
void partGettingWorksProperly(String targetURI, int partNumber, String expectedPart) {
|
||||||
URIPath target = new URIPath(targetURI);
|
URIPath target = new URIPath(targetURI);
|
||||||
Optional<String> expected = Optional.ofNullable(expectedPart);
|
Optional<String> expected = Optional.ofNullable(expectedPart.trim());
|
||||||
Optional<String> result = target.getPart(partNumber);
|
Optional<String> result = target.getPart(partNumber);
|
||||||
assertEquals(expected, result);
|
assertEquals(expected, result);
|
||||||
}
|
}
|
||||||
@ -101,18 +101,18 @@ class URIPathTest {
|
|||||||
assertEquals(expected, result);
|
assertEquals(expected, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest(name = "URIPath {0} removes parts before part {1}: {2}")
|
||||||
@CsvSource({
|
@CsvSource({
|
||||||
"/example/target", "1", "/target",
|
"/example/target", "1", "/target",
|
||||||
"/example/target/", "2", "/",
|
"/example/target/", "2", "/",
|
||||||
"/example/target", "2", "",
|
"/example/target", "2", " ",
|
||||||
"/example/target", "0", "/example/target",
|
"/example/target", "0", "/example/target",
|
||||||
"/example/target/", "1", "/target/",
|
"/example/target/", "1", "/target/",
|
||||||
"", "1", ""
|
" ", "1", " "
|
||||||
})
|
})
|
||||||
void partsAreRemoved(String test, int removeThisMany, String expected) {
|
void partsAreRemoved(String test, int removeThisMany, String expected) {
|
||||||
String result = URIPath.removePartsBefore(test, removeThisMany);
|
String result = URIPath.removePartsBefore(test.trim(), removeThisMany);
|
||||||
assertEquals(expected, result);
|
assertEquals(expected.trim(), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user