VIVO-548 Make unit tests independent of file separator characters.
By converting Strings to Paths before comparing, we should get consistent usage of “/“ and “\”
This commit is contained in:
parent
30fa123948
commit
5bb8a4c698
1 changed files with 6 additions and 7 deletions
|
@ -266,20 +266,19 @@ public class FreemarkerTemplateLoaderTest {
|
|||
* @throws IOException
|
||||
*/
|
||||
private void assertMatches(String searchTerm, int expectedHowMany,
|
||||
String expectedBestFit) {
|
||||
String expectedBestFitString) {
|
||||
Path expectedBestFit = (expectedBestFitString == null) ? null : Paths
|
||||
.get(expectedBestFitString);
|
||||
|
||||
SortedSet<PathPieces> matches = runTheVisitor(searchTerm);
|
||||
int actualHowMany = matches.size();
|
||||
String actualBestFit = matches.isEmpty() ? null : matches.last().path
|
||||
.toString();
|
||||
Path actualBestFit = matches.isEmpty() ? null : matches.last().path;
|
||||
|
||||
if (expectedHowMany != actualHowMany) {
|
||||
fail("How many results: expected " + expectedHowMany
|
||||
+ ", but was " + actualHowMany + ": " + matches);
|
||||
}
|
||||
if (!StringUtils.equals(expectedBestFit, actualBestFit)) {
|
||||
fail("Best result: expected '" + expectedBestFit + "', but was '"
|
||||
+ actualBestFit + "': " + matches);
|
||||
}
|
||||
assertEquals("Best result", expectedBestFit, actualBestFit);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue