From 5bb8a4c698d2147169e246c7baf103e69e5d9a8c Mon Sep 17 00:00:00 2001 From: j2blake Date: Tue, 19 Nov 2013 15:49:41 -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 “\” --- .../loader/FreemarkerTemplateLoaderTest.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 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 5b4d8b40d..89ae79cbf 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 @@ -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 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); } /**