Skip to content

Commit b9e2752

Browse files
committed
HBX-3110: Add a functional test to guard the sanity of the Ant examples
- Add a test verifying the 'classpath' example Signed-off-by: Koen Aers <[email protected]>
1 parent 2e9b6a6 commit b9e2752

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
import org.junit.jupiter.api.Test;
1010
import org.junit.jupiter.api.io.TempDir;
1111

12+
import java.io.ByteArrayOutputStream;
1213
import java.io.File;
14+
import java.io.PrintStream;
1315
import java.net.URISyntaxException;
1416
import java.net.URL;
1517
import java.nio.file.Files;
@@ -43,6 +45,23 @@ public void test5MinuteTutorial() throws Exception {
4345
assertTrue(personFile.exists());
4446
}
4547

48+
@Test
49+
public void testClasspath() throws Exception {
50+
PrintStream savedOut = System.out;
51+
try {
52+
File buildFile = new File(baseFolder, "classpath/build.xml");
53+
Project project = createProject(buildFile);
54+
assertNotNull(project);
55+
ByteArrayOutputStream out = new ByteArrayOutputStream();
56+
assertFalse(out.toString().contains("Hello from Exporter!"));
57+
System.setOut(new PrintStream(out));
58+
project.executeTarget("reveng");
59+
assertTrue(out.toString().contains("Hello from Exporter!"));
60+
} finally {
61+
System.setOut(savedOut);
62+
}
63+
}
64+
4665
private Project createProject(File buildXmlFile) throws Exception {
4766
Project result = new Project();
4867
ProjectHelper projectHelper = ProjectHelper.getProjectHelper();

0 commit comments

Comments
 (0)