@Test
public void getFieldRefMethodDeclaration() {

    int methodArity = new Random().nextInt(20);
    FieldRef fieldRef = fieldRefSupplier.get();
    MethodDeclaration retrieved = DerivedFieldFunctionUtils.getFieldRefMethodDeclaration(fieldRef, STRING_CLASS,
                                                                                         methodArity,
                                                                                         DEFAULT_PARAMETERTYPE_MAP);
    String expectedVariable = String.format("%1$s fieldRefVariable = (%1$s) kiePMMLNameValue.map(%2$s::getValue)" +
                                                    ".orElse(%3$s);",
                                            String.class.getName(),
                                            KiePMMLNameValue.class.getName(),
                                            fieldRef.getMapMissingTo());
    commonValidateFieldRef(retrieved, fieldRef, methodArity, expectedVariable, String.class.getName());
    //
    fieldRef.setMapMissingTo("MAP_MISSING_TO");
    retrieved = DerivedFieldFunctionUtils.getFieldRefMethodDeclaration(fieldRef, STRING_CLASS, methodArity, DEFAULT_PARAMETERTYPE_MAP);
    expectedVariable = String.format("%1$s fieldRefVariable = (%1$s) kiePMMLNameValue.map(%2$s::getValue).orElse" +
                                             "(\"%3$s\");",
                                     String.class.getName(),
                                     KiePMMLNameValue.class.getName(),
                                     fieldRef.getMapMissingTo());
    commonValidateFieldRef(retrieved, fieldRef, methodArity, expectedVariable, String.class.getName());
}