From dedbd1ea2bd3a5bd4665bc0eb83ab726cf0fe31e Mon Sep 17 00:00:00 2001 From: Koen Aers Date: Fri, 12 Sep 2025 09:03:39 +0200 Subject: [PATCH] HBX-3110: Add a functional test to guard the sanity of the Ant examples - Add a test verifying the 'templatepath' example Signed-off-by: Koen Aers --- .../java/org/hibernate/tool/ant/ExamplesTestIT.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java b/ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java index ca953f10a6..96dbecf6b2 100644 --- a/ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java +++ b/ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java @@ -120,6 +120,19 @@ public void testProperties() throws Exception { } } + @Test + public void testTemplatePath() throws Exception { + File buildFile = new File(baseFolder, "templatepath/build.xml"); + Project project = createProject(buildFile); + assertNotNull(project); + File personFile = new File(baseFolder, "templatepath/generated/Person.java"); + assertFalse(personFile.exists()); + project.executeTarget("reveng"); + assertTrue(personFile.exists()); + String personFileContents = new String(Files.readAllBytes(personFile.toPath())); + assertTrue(personFileContents.contains("// This is just an example of a custom template")); + } + private Project createProject(File buildXmlFile) throws Exception { Project result = new Project(); ProjectHelper projectHelper = ProjectHelper.getProjectHelper();