From d8da8bb5273f90d4188748b132cdaaece6719a34 Mon Sep 17 00:00:00 2001 From: Koen Aers Date: Thu, 11 Sep 2025 19:31:38 +0200 Subject: [PATCH] HBX-3110: Add a functional test to guard the sanity of the Ant examples - Add proper verification for the 'properties' example Signed-off-by: Koen Aers --- .../hibernate/tool/ant/ExamplesTestIT.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) 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 fe2e9a1647..ca953f10a6 100644 --- a/ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java +++ b/ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java @@ -101,13 +101,23 @@ public void testNative() throws Exception { @Test public void testProperties() throws Exception { - File buildFile = new File(baseFolder, "properties/build.xml"); - Project project = createProject(buildFile); - assertNotNull(project); -// File fooSqlFile = new File(baseFolder, "native/generated/foo.sql"); -// assertFalse(fooSqlFile.exists()); - project.executeTarget("reveng"); -// assertTrue(fooSqlFile.exists()); + PrintStream savedOut = System.out; + try { + File buildFile = new File(baseFolder, "properties/build.xml"); + Project project = createProject(buildFile); + assertNotNull(project); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + System.setOut(new PrintStream(out)); + assertFalse(out.toString().contains("Hello, World!")); + assertFalse(out.toString().contains("Hello, Foo!")); + assertFalse(out.toString().contains("Hello, Bar!")); + project.executeTarget("reveng"); + assertTrue(out.toString().contains("Hello, World!")); + assertTrue(out.toString().contains("Hello, Foo!")); + assertTrue(out.toString().contains("Hello, Bar!")); + } finally { + System.setOut(savedOut); + } } private Project createProject(File buildXmlFile) throws Exception {