Search in sources :

Example 1 with ClassSummary

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

the class SummarizerTest method testClassSummarizer.

@Test
public void testClassSummarizer() throws IOException {
    InputStream resource = getClass().getResourceAsStream("/org/mybatis/generator/eclipse/tests/harness/tests/resources/OuterClass.src");
    CompilationUnitSummary cuSummary = getCompilationUnitSummaryFromResource(resource);
    assertThat(cuSummary, hasImportCount(2));
    assertThat(cuSummary, hasImport(IMPORT_JAVA_IO_SERIALIZABLE));
    assertThat(cuSummary, hasImport("import java.util.ArrayList"));
    assertThat(cuSummary, hasClassCount(2));
    assertThat(cuSummary, hasClass("SecondOuterClass"));
    assertThat(cuSummary, hasClass("OuterClass"));
    assertThat(cuSummary, hasEnumCount(0));
    assertThat(cuSummary, hasInterfaceCount(0));
    ClassSummary classSummary = cuSummary.getClassSummary("OuterClass");
    assertThat(classSummary, hasSuperClass("ArrayList<String>"));
    assertThat(classSummary, hasSuperInterface(SERIALIZABLE));
    assertThat(classSummary, hasSuperInterfaceCount(1));
    assertThat(classSummary, hasField("serialVersionUID", withFieldType("long")));
    assertThat(classSummary, hasField("unreliableCount"));
    assertThat(classSummary, hasFieldCount(2));
    assertThat(classSummary, hasMethod("add(String)"));
    assertThat(classSummary, hasMethod("getUnreliableCount()"));
    assertThat(classSummary, hasMethodCount(2));
    verifyInners(classSummary);
}
Also used : InputStream(java.io.InputStream) CompilationUnitSummary(org.mybatis.generator.eclipse.tests.harness.summary.CompilationUnitSummary) ClassSummary(org.mybatis.generator.eclipse.tests.harness.summary.ClassSummary) Test(org.junit.Test)

Aggregations

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