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 time for sure.
This commit is contained in:
parent
b3c5892679
commit
b6da0052ce
1 changed files with 7 additions and 5 deletions
|
@ -286,18 +286,20 @@ public class FreemarkerTemplateLoaderTest {
|
||||||
* would.
|
* would.
|
||||||
*/
|
*/
|
||||||
private void assertFM(String searchTerm, int expectedNumberOfTries,
|
private void assertFM(String searchTerm, int expectedNumberOfTries,
|
||||||
String expectedBestFit) {
|
String expectedBestString) {
|
||||||
|
Path expectedBestFit = expectedBestString == null ? null : Paths
|
||||||
|
.get(expectedBestString);
|
||||||
PathPieces stPp = new PathPieces(searchTerm);
|
PathPieces stPp = new PathPieces(searchTerm);
|
||||||
|
|
||||||
int actualNumberOfTries = 0;
|
int actualNumberOfTries = 0;
|
||||||
String actualBestFit = null;
|
Path actualBestFit = null;
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(stPp.region)) {
|
if (StringUtils.isNotBlank(stPp.region)) {
|
||||||
actualNumberOfTries++;
|
actualNumberOfTries++;
|
||||||
SortedSet<PathPieces> matches = runTheVisitor(stPp.base
|
SortedSet<PathPieces> matches = runTheVisitor(stPp.base
|
||||||
+ stPp.language + stPp.region + stPp.extension);
|
+ stPp.language + stPp.region + stPp.extension);
|
||||||
if (!matches.isEmpty()) {
|
if (!matches.isEmpty()) {
|
||||||
actualBestFit = matches.last().path.toString();
|
actualBestFit = matches.last().path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (actualBestFit == null && StringUtils.isNotBlank(stPp.language)) {
|
if (actualBestFit == null && StringUtils.isNotBlank(stPp.language)) {
|
||||||
|
@ -305,7 +307,7 @@ public class FreemarkerTemplateLoaderTest {
|
||||||
SortedSet<PathPieces> matches = runTheVisitor(stPp.base
|
SortedSet<PathPieces> matches = runTheVisitor(stPp.base
|
||||||
+ stPp.language + stPp.extension);
|
+ stPp.language + stPp.extension);
|
||||||
if (!matches.isEmpty()) {
|
if (!matches.isEmpty()) {
|
||||||
actualBestFit = matches.last().path.toString();
|
actualBestFit = matches.last().path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (actualBestFit == null) {
|
if (actualBestFit == null) {
|
||||||
|
@ -313,7 +315,7 @@ public class FreemarkerTemplateLoaderTest {
|
||||||
SortedSet<PathPieces> matches = runTheVisitor(stPp.base
|
SortedSet<PathPieces> matches = runTheVisitor(stPp.base
|
||||||
+ stPp.extension);
|
+ stPp.extension);
|
||||||
if (!matches.isEmpty()) {
|
if (!matches.isEmpty()) {
|
||||||
actualBestFit = matches.last().path.toString();
|
actualBestFit = matches.last().path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue