static void mergeNodeReferences(final JavaParserDTO toPopulate, final NodeNamesDTO nestedNodeNamesDTO, final MethodCallExpr evaluateNodeInitializer) {
        final NodeList<Expression> evaluateNodeReferences = evaluateNodeInitializer.getArguments();
        final String expectedReference = String.format(PACKAGE_CLASS_TEMPLATE, toPopulate.packageName,
                                                       nestedNodeNamesDTO.nodeClassName);
        Optional<MethodReferenceExpr> found = Optional.empty();
        for (Expression expression : evaluateNodeReferences) {
            if (expectedReference.equals(expression.asMethodReferenceExpr().getScope().toString())) {
                found = Optional.of(expression.asMethodReferenceExpr());
                break;
            }
        }
        final MethodReferenceExpr evaluateNodeReference = found
                .orElseThrow(() -> new KiePMMLException(String.format(MISSING_METHOD_REFERENCE_TEMPLATE,
                                                                      expectedReference, evaluateNodeInitializer)));
        String identifier = EVALUATE_NODE + nestedNodeNamesDTO.nodeClassName;
        evaluateNodeReference.setScope(new NameExpr(toPopulate.nodeClassName));
        evaluateNodeReference.setIdentifier(identifier);
    }
@Test
    void mergeNodeReferences() {
        KiePMMLNodeFactory.NodeNamesDTO nodeNamesDTO = new KiePMMLNodeFactory.NodeNamesDTO(nodeRoot,
                createNodeClassName(), null,
                1.0);
        KiePMMLNodeFactory.JavaParserDTO toPopulate = new KiePMMLNodeFactory.JavaParserDTO(nodeNamesDTO, PACKAGE_NAME);
        Node nestedNode = nodeRoot.getNodes().get(0);
        // Creating evaluateNodeInitializer
        String nestedNodeClassName = nodeNamesDTO.childrenNodes.get(nestedNode);
        String fullNestedNodeClassName = String.format(PACKAGE_CLASS_TEMPLATE, PACKAGE_NAME, nestedNodeClassName);

        final NodeList<Expression> methodReferenceExprs =
                NodeList.nodeList(KiePMMLNodeFactory.getEvaluateNodeMethodReference(fullNestedNodeClassName));
        MethodReferenceExpr evaluateNodeReference = new MethodReferenceExpr();
        evaluateNodeReference.setScope(new NameExpr(fullNestedNodeClassName));
        evaluateNodeReference.setIdentifier(EVALUATE_NODE);
        MethodCallExpr evaluateNodeInitializer = new MethodCallExpr();
        evaluateNodeInitializer.setScope(new TypeExpr(parseClassOrInterfaceType(Arrays.class.getName())));
        evaluateNodeInitializer.setName(AS_LIST);
        evaluateNodeInitializer.setArguments(methodReferenceExprs);
        //
        KiePMMLNodeFactory.NodeNamesDTO nestedNodeNamesDTO = new KiePMMLNodeFactory.NodeNamesDTO(nestedNode,
                nodeNamesDTO.getNestedNodeClassName(nestedNode), nodeNamesDTO.nodeClassName, nodeNamesDTO.missingValuePenalty);
        KiePMMLNodeFactory.mergeNodeReferences(toPopulate, nestedNodeNamesDTO, evaluateNodeInitializer);

        MethodReferenceExpr retrieved = evaluateNodeInitializer.getArguments().get(0).asMethodReferenceExpr();
        String expected = toPopulate.nodeClassName;
        assertThat(retrieved.getScope().asNameExpr().toString()).isEqualTo(expected);
        expected = EVALUATE_NODE + nestedNodeClassName;
        assertThat(retrieved.getIdentifier()).isEqualTo(expected);
    }