From b6da0052ce2402a62434c4ee24d3509959f8a381 Mon Sep 17 00:00:00 2001 From: j2blake Date: Wed, 20 Nov 2013 10:17:27 -0500 Subject: [PATCH] VIVO-548 Make unit tests independent of file separator characters. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By converting Strings to Paths before comparing, we should get consistent usage of “/“ and “\”. This time for sure. --- .../loader/FreemarkerTemplateLoaderTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/freemarker/loader/FreemarkerTemplateLoaderTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/freemarker/loader/FreemarkerTemplateLoaderTest.java index 89ae79cbf..cd375cb8b 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/freemarker/loader/FreemarkerTemplateLoaderTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/freemarker/loader/FreemarkerTemplateLoaderTest.java @@ -286,18 +286,20 @@ public class FreemarkerTemplateLoaderTest { * would. */ private void assertFM(String searchTerm, int expectedNumberOfTries, - String expectedBestFit) { + String expectedBestString) { + Path expectedBestFit = expectedBestString == null ? null : Paths + .get(expectedBestString); PathPieces stPp = new PathPieces(searchTerm); int actualNumberOfTries = 0; - String actualBestFit = null; + Path actualBestFit = null; if (StringUtils.isNotBlank(stPp.region)) { actualNumberOfTries++; SortedSet matches = runTheVisitor(stPp.base + stPp.language + stPp.region + stPp.extension); if (!matches.isEmpty()) { - actualBestFit = matches.last().path.toString(); + actualBestFit = matches.last().path; } } if (actualBestFit == null && StringUtils.isNotBlank(stPp.language)) { @@ -305,7 +307,7 @@ public class FreemarkerTemplateLoaderTest { SortedSet matches = runTheVisitor(stPp.base + stPp.language + stPp.extension); if (!matches.isEmpty()) { - actualBestFit = matches.last().path.toString(); + actualBestFit = matches.last().path; } } if (actualBestFit == null) { @@ -313,7 +315,7 @@ public class FreemarkerTemplateLoaderTest { SortedSet matches = runTheVisitor(stPp.base + stPp.extension); if (!matches.isEmpty()) { - actualBestFit = matches.last().path.toString(); + actualBestFit = matches.last().path; } }