use of org.mybatis.generator.eclipse.core.merge.NewJavaFileVisitor in project generator by mybatis.
the class NewJavaFileVisitorTest method testSimpleClass.
@Test
public void testSimpleClass() {
CompilationUnit cu = getCompilationUnitFromSource(TestResourceGenerator.simpleClassWithAllGeneratedItems());
NewJavaFileVisitor visitor = new NewJavaFileVisitor();
cu.accept(visitor);
assertThat(visitor.getImports().size(), is(0));
assertThat(visitor.getNewNodes().size(), is(3));
assertThat(visitor.getSuperclass(), is(nullValue()));
assertThat(visitor.getSuperInterfaceTypes().size(), is(0));
assertThat(visitor.isInterface(), is(false));
}
use of org.mybatis.generator.eclipse.core.merge.NewJavaFileVisitor in project generator by mybatis.
the class NewJavaFileVisitorTest method testRegularInterface.
@Test
public void testRegularInterface() throws IOException {
InputStream resource = getClass().getResourceAsStream("/org/mybatis/generator/eclipse/core/tests/merge/resources/AwfulTableMapper.java.src");
CompilationUnit cu = getCompilationUnitFromResource(resource);
NewJavaFileVisitor visitor = new NewJavaFileVisitor();
cu.accept(visitor);
assertThat(visitor.getImports().size(), is(11));
assertThat(visitor.getNewNodes().size(), is(11));
assertThat(visitor.getSuperclass(), is(nullValue()));
assertThat(visitor.getSuperInterfaceTypes().size(), is(0));
assertThat(visitor.isInterface(), is(true));
}
use of org.mybatis.generator.eclipse.core.merge.NewJavaFileVisitor in project generator by mybatis.
the class NewJavaFileVisitorTest method testRegularClass.
@Test
public void testRegularClass() throws IOException {
InputStream resource = getClass().getResourceAsStream("/org/mybatis/generator/eclipse/core/tests/merge/resources/AwfulTable.java.src");
CompilationUnit cu = getCompilationUnitFromResource(resource);
NewJavaFileVisitor visitor = new NewJavaFileVisitor();
cu.accept(visitor);
assertThat(visitor.getImports().size(), is(1));
assertThat(visitor.getNewNodes().size(), is(50));
assertThat(visitor.getSuperclass().isSimpleType(), is(true));
assertThat(((SimpleType) visitor.getSuperclass()).getName().getFullyQualifiedName(), is("AwfulTableKey"));
assertThat(visitor.getSuperInterfaceTypes().size(), is(0));
assertThat(visitor.isInterface(), is(false));
}
use of org.mybatis.generator.eclipse.core.merge.NewJavaFileVisitor in project generator by mybatis.
the class NewJavaFileVisitorTest method testComplexClass.
@Test
public void testComplexClass() throws IOException {
InputStream resource = getClass().getResourceAsStream("/org/mybatis/generator/eclipse/core/tests/merge/resources/AwfulTableExample.java.src");
CompilationUnit cu = getCompilationUnitFromResource(resource);
NewJavaFileVisitor visitor = new NewJavaFileVisitor();
cu.accept(visitor);
assertThat(visitor.getImports().size(), is(2));
assertThat(visitor.getNewNodes().size(), is(17));
assertThat(visitor.getSuperclass(), is(nullValue()));
assertThat(visitor.getSuperInterfaceTypes().size(), is(0));
assertThat(visitor.isInterface(), is(false));
}
Aggregations