From 27d161b9943a1079e2f4cb8ad79f59aebfcea0f4 Mon Sep 17 00:00:00 2001 From: Jym Dyer Date: Wed, 13 Dec 2023 19:28:25 -0800 Subject: [PATCH] Added Javadoc to unit test, to explain the process by which snapshot files are first generated and need to be regenerated when template files are changed. --- .../middleware/utils/TemplateUtilsTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/opentripplanner/middleware/utils/TemplateUtilsTest.java b/src/test/java/org/opentripplanner/middleware/utils/TemplateUtilsTest.java index f5084e20c..dbcd219a1 100644 --- a/src/test/java/org/opentripplanner/middleware/utils/TemplateUtilsTest.java +++ b/src/test/java/org/opentripplanner/middleware/utils/TemplateUtilsTest.java @@ -16,6 +16,14 @@ import static com.zenika.snapshotmatcher.SnapshotMatcher.matchesSnapshot; import static org.hamcrest.MatcherAssert.assertThat; +/** + * Unit tests for {@code resources/templates/*.ftl} Freemarker Template Language files. + *

+ * When the tests are first run, the {@code com.zenika.snapshotmatcher.SnapshotMatcher} class will create JSON snapshot + * files in {@code resources/snapshots/org/opentripplanner/middleware} which are used thereafter to compare with the + * results of the template files. If you change any {@code *.ftl} files you will need to delete their corresponding + * snapshot files, run the tests to create new snapshots, and then commit those files along with new template files. + */ public class TemplateUtilsTest extends OtpMiddlewareTestEnvironment { /** * A parameterized test that checks whether various templates render in a way that matches a snapshot. The name of @@ -104,4 +112,4 @@ private static void assertMatchesSnapshot(String actual, String snapshotName) String actualWithStandardLineSeparators = actual.replaceAll("\r\n", "\n"); assertThat(actualWithStandardLineSeparators, matchesSnapshot(snapshotName)); } -} \ No newline at end of file +}