PMMLRestResourceGenerator { void setPathValue(ClassOrInterfaceDeclaration template) { template.findFirst(SingleMemberAnnotationExpr.class).orElseThrow(() -> new RuntimeException("")).setMemberValue(new StringLiteralExpr(nameURL)); } PMMLRestResourceGenerator(KiePMMLModel model, String appCanonicalName); String generate(); String getNameURL(); KiePMMLModel getKiePMMLModel(); PMMLRestResourceGenerator withDependencyInjection(DependencyInjectionAnnotator annotator); String className(); String generatedFilePath();  }
@Test void setPathValue() { final Optional<SingleMemberAnnotationExpr> retrievedOpt = template.findFirst(SingleMemberAnnotationExpr.class); assertTrue(retrievedOpt.isPresent()); SingleMemberAnnotationExpr retrieved = retrievedOpt.get(); assertEquals("Path", retrieved.getName().asString()); pmmlRestResourceGenerator.setPathValue(template); try { String classPrefix = getSanitizedClassName(KIE_PMML_MODEL.getName()); String expected = URLEncoder.encode(classPrefix).replaceAll("\\+", "%20"); assertEquals(expected, retrieved.getMemberValue().asStringLiteralExpr().asString()); } catch (Exception e) { fail(e); } }