DefineFunctionUtils { static MethodDeclaration getApplyMethodDeclaration(final String methodName, final Apply apply, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { return getApplyExpressionMethodDeclaration(methodName, apply, returnedType, parameterNameTypeMap); } private  DefineFunctionUtils();   }
@Test public void getApplyMethodDeclaration() { String methodName = "METHOD_NAME"; MethodDeclaration retrieved = DefineFunctionUtils.getApplyMethodDeclaration(methodName, applySupplier.get(), OBJECT_CLASS, DEFAULT_PARAMETERTYPE_MAP); String expected = String.format("java.lang.Object %s(java.util.List<org.kie.pmml.commons.model.tuples.KiePMMLNameValue> param1) {\n" + " java.lang.Object variableapplyVariableConstant1 = 34.6;\n" + " java.util.Optional<org.kie.pmml.commons.model.tuples.KiePMMLNameValue> kiePMMLNameValue = param1.stream().filter((org.kie.pmml.commons.model.tuples.KiePMMLNameValue lmbdParam) -> java.util.Objects.equals(\"FIELD_REF\", lmbdParam.getName())).findFirst();\n" + " java.lang.Object variableapplyVariableFieldRef2 = (java.lang.Object) kiePMMLNameValue.map(org.kie.pmml.commons.model.tuples.KiePMMLNameValue::getValue).orElse(null);\n" + " java.lang.Object applyVariable = this.FUNCTION_NAME(param1, variableapplyVariableConstant1, variableapplyVariableFieldRef2);\n" + " return applyVariable;\n" + "}", methodName); assertEquals(expected, retrieved.toString()); }