@Test
public void getFieldRefExpressionFromDefineFunctionBlockStmt() {

    String variableName = "VARIABLE_NAME";
    FieldRef fieldRef = fieldRefSupplier.get();
    ParameterField parameterField = new ParameterField(FieldName.create("FIELD_REF"));
    LinkedHashMap<String, ClassOrInterfaceType> modifiedParametersMap = new LinkedHashMap<>(DEFAULT_PARAMETERTYPE_MAP);
    modifiedParametersMap.put(parameterField.getName().toString(), parseClassOrInterfaceType(getBoxedClassName(parameterField)));
    BlockStmt retrieved = ExpressionFunctionUtils.getFieldRefExpressionFromDefineFunctionBlockStmt(variableName, fieldRef,
                                                                                               parseClassOrInterfaceType(Object.class.getName()), modifiedParametersMap);
    String expected = "{\n" +
            "    java.lang.Object VARIABLE_NAME = FIELD_REF != null ? (java.lang.Object) org.kie.pmml.commons.utils.ConverterTypeUtil.convert(java.lang.Object.class, FIELD_REF) : (java.lang.Object) null;\n" +
            "}";
    assertEquals(expected, retrieved.toString());
    String mapMissingTo = "MAP_MISSING_TO";
    fieldRef.setMapMissingTo(mapMissingTo);
    retrieved = ExpressionFunctionUtils.getFieldRefExpressionFromDefineFunctionBlockStmt(variableName, fieldRef,
                                                                                     parseClassOrInterfaceType(Object.class.getName()), modifiedParametersMap);
    expected = "{\n" +
            "    java.lang.Object VARIABLE_NAME = FIELD_REF != null ? (java.lang.Object) org.kie.pmml.commons.utils.ConverterTypeUtil.convert(java.lang.Object.class, FIELD_REF) : (java.lang.Object) \"MAP_MISSING_TO\";\n" +
            "}";
    assertEquals(expected, retrieved.toString());
}