use of com.devonfw.cobigen.javaplugin.merger.JavaMerger in project cobigen by devonfw.
the class JavaMergerTest method testMergeClassAnnotation.
/**
* Tests merging the class annotation into the baseFile
*
* @throws IOException shouldn't happen
* @throws MergeException shouldn't happen either
*/
@Test
public void testMergeClassAnnotation() throws IOException, MergeException {
File baseFile = new File(testFileRootPath + "BaseFile_ClassAnnotation.java");
File patchFile = new File(testFileRootPath + "PatchFile_ClassAnnotation.java");
// with override
String mergedContents = new JavaMerger("", true).merge(baseFile, FileUtils.readFileToString(patchFile, StandardCharsets.UTF_8), "UTF-8");
assertThat(mergedContents).contains("@Entity");
assertThat(mergedContents).contains("@javax.persistence.Table(name=\"Visitor\")");
// without override
mergedContents = new JavaMerger("", false).merge(baseFile, FileUtils.readFileToString(patchFile, StandardCharsets.UTF_8), "UTF-8");
assertThat(mergedContents).contains("@Entity");
assertThat(mergedContents).contains("@javax.persistence.Table(name=\"Visits\")");
}
Aggregations