Search in sources :

Example 1 with JavaTypeInfo

use of org.kie.workbench.common.services.datamodeller.core.JavaTypeInfo in project kie-wb-common by kiegroup.

the class JavaRoasterModelDriverTest method loadJavaTypeInfoTest.

@Test
public void loadJavaTypeInfoTest() throws ModelDriverException {
    Path path = rootPath.resolve("package1").resolve("Pojo1.java");
    String source = ioService.readAllString(path);
    JavaRoasterModelDriver javaRoasterModelDriver = new JavaRoasterModelDriver();
    TypeInfoResult typeInfoResult = javaRoasterModelDriver.loadJavaTypeInfo(source);
    assertFalse(typeInfoResult.hasErrors());
    JavaTypeInfo typeInfo = typeInfoResult.getTypeInfo();
    DataObject pojo1 = createPojo1();
    assertEquals(pojo1.getName(), typeInfo.getName());
    assertEquals(pojo1.getPackageName(), typeInfo.getPackageName());
    assertTrue(pojo1.isClass());
    assertFalse(pojo1.isAbstract());
    assertFalse(typeInfo.isAnnotation());
    assertFalse(typeInfo.isEnum());
    assertFalse(typeInfo.isInterface());
    assertTrue(typeInfo.isPublic());
    assertFalse(typeInfo.isPackagePrivate());
    assertFalse(typeInfo.isProtected());
    assertFalse(typeInfo.isPrivate());
}
Also used : Path(org.uberfire.java.nio.file.Path) DataObject(org.kie.workbench.common.services.datamodeller.core.DataObject) JavaTypeInfo(org.kie.workbench.common.services.datamodeller.core.JavaTypeInfo) JavaRoasterModelDriver(org.kie.workbench.common.services.datamodeller.driver.impl.JavaRoasterModelDriver) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 DataObject (org.kie.workbench.common.services.datamodeller.core.DataObject)1 JavaTypeInfo (org.kie.workbench.common.services.datamodeller.core.JavaTypeInfo)1 JavaRoasterModelDriver (org.kie.workbench.common.services.datamodeller.driver.impl.JavaRoasterModelDriver)1 Path (org.uberfire.java.nio.file.Path)1