@Test
public void getFieldRefExpressionFromCommonDataBlockStmt() {

    String variableName = "VARIABLE_NAME";
    FieldRef fieldRef = fieldRefSupplier.get();
    BlockStmt retrieved = ExpressionFunctionUtils.getFieldRefExpressionFromCommonDataBlockStmt(variableName, fieldRef,
                                                                                               parseClassOrInterfaceType(Object.class.getName()), DEFAULT_PARAMETERTYPE_MAP);
    String expected = "{\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 VARIABLE_NAME = (java.lang.Object) kiePMMLNameValue.map(org.kie.pmml.commons" +
            ".model.tuples.KiePMMLNameValue::getValue).orElse(null);\n" +
            "}";
    assertEquals(expected, retrieved.toString());
    String mapMissingTo = "MAP_MISSING_TO";
    fieldRef.setMapMissingTo(mapMissingTo);
    retrieved = ExpressionFunctionUtils.getFieldRefExpressionFromCommonDataBlockStmt(variableName, fieldRef,
                                                                                     parseClassOrInterfaceType(Object.class.getName()), DEFAULT_PARAMETERTYPE_MAP);
    expected = "{\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 VARIABLE_NAME = (java.lang.Object) kiePMMLNameValue.map(org.kie.pmml.commons" +
            ".model.tuples.KiePMMLNameValue::getValue).orElse(\"MAP_MISSING_TO\");\n" +
            "}";
    assertEquals(expected, retrieved.toString());
}