use of org.mybatis.generator.api.dom.DefaultXmlFormatter in project generator by mybatis.
the class XmlFileMergerTest method testThatFilesAreTheSameAfterMerge.
@Test
public void testThatFilesAreTheSameAfterMerge() throws Exception {
DefaultXmlFormatter xmlFormatter = new DefaultXmlFormatter();
Properties p = new Properties();
p.setProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE, "true");
CommentGenerator commentGenerator = new DefaultCommentGenerator();
commentGenerator.addConfigurationProperties(p);
Document document = new Document(XmlConstants.MYBATIS3_MAPPER_PUBLIC_ID, XmlConstants.MYBATIS3_MAPPER_SYSTEM_ID);
document.setRootElement(getSqlMapElement(commentGenerator));
GeneratedXmlFile generatedFile1 = new GeneratedXmlFile(document, "TestMapper.xml", "org.mybatis.test", "src", true, xmlFormatter);
InputSource is1 = new InputSource(new StringReader(generatedFile1.getFormattedContent()));
GeneratedXmlFile generatedFile2 = new GeneratedXmlFile(document, "TestMapper.xml", "org.mybatis.test", "src", true, xmlFormatter);
InputSource is2 = new InputSource(new StringReader(generatedFile2.getFormattedContent()));
String mergedSource = XmlFileMergerJaxp.getMergedSource(is1, is2, "TestMapper.xml");
assertEquals(generatedFile1.getFormattedContent(), mergedSource);
}
Aggregations