Skip to content

Commit d8da8bb

Browse files
committed
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 <[email protected]>
1 parent 0313d38 commit d8da8bb

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,23 @@ public void testNative() throws Exception {
101101

102102
@Test
103103
public void testProperties() throws Exception {
104-
File buildFile = new File(baseFolder, "properties/build.xml");
105-
Project project = createProject(buildFile);
106-
assertNotNull(project);
107-
// File fooSqlFile = new File(baseFolder, "native/generated/foo.sql");
108-
// assertFalse(fooSqlFile.exists());
109-
project.executeTarget("reveng");
110-
// assertTrue(fooSqlFile.exists());
104+
PrintStream savedOut = System.out;
105+
try {
106+
File buildFile = new File(baseFolder, "properties/build.xml");
107+
Project project = createProject(buildFile);
108+
assertNotNull(project);
109+
ByteArrayOutputStream out = new ByteArrayOutputStream();
110+
System.setOut(new PrintStream(out));
111+
assertFalse(out.toString().contains("Hello, World!"));
112+
assertFalse(out.toString().contains("Hello, Foo!"));
113+
assertFalse(out.toString().contains("Hello, Bar!"));
114+
project.executeTarget("reveng");
115+
assertTrue(out.toString().contains("Hello, World!"));
116+
assertTrue(out.toString().contains("Hello, Foo!"));
117+
assertTrue(out.toString().contains("Hello, Bar!"));
118+
} finally {
119+
System.setOut(savedOut);
120+
}
111121
}
112122

113123
private Project createProject(File buildXmlFile) throws Exception {

0 commit comments

Comments
 (0)