Skip to content

Commit dedbd1e

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

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,19 @@ public void testProperties() throws Exception {
120120
}
121121
}
122122

123+
@Test
124+
public void testTemplatePath() throws Exception {
125+
File buildFile = new File(baseFolder, "templatepath/build.xml");
126+
Project project = createProject(buildFile);
127+
assertNotNull(project);
128+
File personFile = new File(baseFolder, "templatepath/generated/Person.java");
129+
assertFalse(personFile.exists());
130+
project.executeTarget("reveng");
131+
assertTrue(personFile.exists());
132+
String personFileContents = new String(Files.readAllBytes(personFile.toPath()));
133+
assertTrue(personFileContents.contains("// This is just an example of a custom template"));
134+
}
135+
123136
private Project createProject(File buildXmlFile) throws Exception {
124137
Project result = new Project();
125138
ProjectHelper projectHelper = ProjectHelper.getProjectHelper();

0 commit comments

Comments
 (0)