Search in sources :

Example 1 with EnumSummary

use of org.mybatis.generator.eclipse.tests.harness.summary.EnumSummary in project generator by mybatis.

the class SummarizerTest method testEnumSummarizer.

@Test
public void testEnumSummarizer() throws IOException {
    InputStream resource = getClass().getResourceAsStream("/org/mybatis/generator/eclipse/tests/harness/tests/resources/OuterEnum.src");
    CompilationUnitSummary cuSummary = getCompilationUnitSummaryFromResource(resource);
    assertThat(cuSummary, hasImportCount(1));
    assertThat(cuSummary, hasImport(IMPORT_JAVA_IO_SERIALIZABLE));
    assertThat(cuSummary, hasClassCount(0));
    assertThat(cuSummary, hasEnumCount(2));
    assertThat(cuSummary, hasEnum("SecondOuterEnum"));
    assertThat(cuSummary, hasEnum("OuterEnum"));
    assertThat(cuSummary, hasInterfaceCount(0));
    EnumSummary enumSummary = cuSummary.getEnumSummary("OuterEnum");
    assertThat(enumSummary, hasEnumConstant("FRED"));
    assertThat(enumSummary, hasEnumConstant("WILMA"));
    assertThat(enumSummary, hasEnumConstant("BARNEY"));
    assertThat(enumSummary, hasEnumConstant("BETTY"));
    assertThat(enumSummary, hasEnumConstantCount(4));
    assertThat(enumSummary, hasSuperInterface(SERIALIZABLE));
    assertThat(enumSummary, hasSuperInterfaceCount(1));
    assertThat(enumSummary, hasField("name"));
    assertThat(enumSummary, hasFieldCount(1));
    assertThat(enumSummary, hasMethod("OuterEnum(String)"));
    assertThat(enumSummary, hasMethod("getName()"));
    assertThat(enumSummary, hasMethodCount(2));
    verifyInners(enumSummary);
}
Also used : InputStream(java.io.InputStream) CompilationUnitSummary(org.mybatis.generator.eclipse.tests.harness.summary.CompilationUnitSummary) EnumSummary(org.mybatis.generator.eclipse.tests.harness.summary.EnumSummary) Test(org.junit.Test)

Aggregations

InputStream (java.io.InputStream)1 Test (org.junit.Test)1 CompilationUnitSummary (org.mybatis.generator.eclipse.tests.harness.summary.CompilationUnitSummary)1 EnumSummary (org.mybatis.generator.eclipse.tests.harness.summary.EnumSummary)1