DerivedFieldFunctionUtils { static MethodDeclaration getApplyMethodDeclaration(final Apply apply, final ClassOrInterfaceType returnedType, final int methodArity, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { String methodName = String.format(METHOD_NAME_TEMPLATE, apply.getClass().getSimpleName(), methodArity); return getApplyExpressionMethodDeclaration(methodName, apply, returnedType, parameterNameTypeMap); } private  DerivedFieldFunctionUtils();   }
@Test public void getApplyMethodDeclaration() { MethodDeclaration retrieved = DerivedFieldFunctionUtils.getApplyMethodDeclaration(applySupplier.get(), OBJECT_CLASS, 3, DEFAULT_PARAMETERTYPE_MAP); String expected = "java.lang.Object Apply3(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" + "}"; assertEquals(expected, retrieved.toString()); }