JavaParserUtils { public static String getFullClassName(final CompilationUnit cu) { String packageName = cu.getPackageDeclaration() .orElseThrow(() ->new KiePMMLException("Missing package declaration for " + cu.toString())) .getName().asString(); String className = cu.getType(0).getName().asString(); return packageName + "." + className; } private  JavaParserUtils(); static CompilationUnit getFromFileName(String fileName); static CompilationUnit getKiePMMLModelCompilationUnit(final String className,
                                                                 final String packageName,
                                                                 final String javaTemplate,
                                                                 final String modelClassName); static String getFullClassName(final CompilationUnit cu); static final String MAIN_CLASS_NOT_FOUND; }
@Test public void getFullClassName() { String className = "ClassName"; String packageName = "apackage"; PackageDeclaration packageDeclaration = new PackageDeclaration(); packageDeclaration.setName(new Name(packageName)); ClassOrInterfaceDeclaration classOrInterfaceDeclaration = new ClassOrInterfaceDeclaration(); classOrInterfaceDeclaration.setName(className); CompilationUnit compilationUnit = new CompilationUnit(); compilationUnit.setPackageDeclaration(packageDeclaration); compilationUnit.setTypes(NodeList.nodeList(classOrInterfaceDeclaration)); String retrieved = JavaParserUtils.getFullClassName(compilationUnit); String expected = packageName + "." + className; assertEquals(expected, retrieved); }