use of org.mybatis.generator.eclipse.tests.harness.summary.AnnotationSummary in project generator by mybatis.
the class SummarizerTest method testAnnotationSummarizer.
@Test
public void testAnnotationSummarizer() throws IOException {
InputStream resource = getClass().getResourceAsStream("/org/mybatis/generator/eclipse/tests/harness/tests/resources/OuterAnnotation.src");
CompilationUnitSummary cuSummary = getCompilationUnitSummaryFromResource(resource);
assertThat(cuSummary, hasImportCount(4));
assertThat(cuSummary, hasImport("import java.lang.annotation.ElementType"));
assertThat(cuSummary, hasImport("import java.lang.annotation.Retention"));
assertThat(cuSummary, hasImport("import java.lang.annotation.RetentionPolicy"));
assertThat(cuSummary, hasImport("import java.lang.annotation.Target"));
assertThat(cuSummary, hasAnnotationCount(2));
assertThat(cuSummary, hasAnnotation("OuterAnnotation"));
assertThat(cuSummary, hasAnnotation("SecondOuterAnnotation"));
assertThat(cuSummary, hasClassCount(0));
assertThat(cuSummary, hasEnumCount(0));
assertThat(cuSummary, hasInterfaceCount(0));
AnnotationSummary annotationSummary = cuSummary.getAnnotationSummary("OuterAnnotation");
assertThat(annotationSummary, hasAnnotationMember("name"));
assertThat(annotationSummary, hasAnnotationMemberCount(1));
assertThat(annotationSummary, hasField("id", ofType("int")));
assertThat(annotationSummary, hasField("id2", ofType("int")));
assertThat(annotationSummary, hasField("name", ofType("int")));
assertThat(annotationSummary, hasFieldCount(3));
verifyInners(annotationSummary);
}
Aggregations