Code review comment: Shall we add the test function name too here, so that it's easier to identify the exact error?

Code under review:
private static void resolveFunctions(TestSuite suite) {
        List<TesterinaFunction> functions = suite.getTestUtilityFunctions();
        List<String> functionNames = functions.stream().map(testerinaFunction -> testerinaFunction.getName()).collect
                (Collectors.toList());
        for (Test test : suite.getTests()) {
            if (test.getTestName() != null && functionNames.contains(test.getTestName())) {
                test.setTestFunction(functions.stream().filter(e -> e.getName().equals(test
                        .getTestName())).findFirst().get());
            }

            if (test.getBeforeTestFunction() != null && functionNames.contains(test.getBeforeTestFunction())) {
                test.setBeforeTestFunctionObj(functions.stream().filter(e -> e.getName().equals(test
                        .getBeforeTestFunction())).findFirst().get());
            }

            if (test.getAfterTestFunction() != null && functionNames.contains(test.getAfterTestFunction())) {
                test.setAfterTestFunctionObj(functions.stream().filter(e -> e.getName().equals(test
                        .getAfterTestFunction())).findFirst().get());
            }

            if (test.getDataProvider() != null && functionNames.contains(test.getDataProvider())) {
                String dataProvider = test.getDataProvider();
                test.setDataProviderFunction(functions.stream().filter(e -> e.getName().equals(test.getDataProvider()
                )).findFirst().map(func -> {
                    
                    if (func.getbFunction().getRetParamTypes().length == 1) {
                        BType bType = func.getbFunction().getRetParamTypes()[0];
                        if (bType.getTag() == TypeTags.ARRAY_TAG) {
                            BArrayType bArrayType = (BArrayType) bType;
                            if (bArrayType.getElementType().getTag() != TypeTags.ARRAY_TAG) {
                                String message = String.format("Data provider function [%s] should return an array of" +
                                        " arrays.", dataProvider);
                                throw new BallerinaException(message);
                            }
                        } else {
                            String message = String.format("Data provider function [%s] should return an array of " +
                                    "arrays.", dataProvider);
                            throw new BallerinaException(message);
                        }
                    } else {
                        String message = String.format("Data provider function [%s] should have only one return type" +
                                ".", dataProvider);
                        throw new BallerinaException(message);
                    }
                    return func;
                }).get());

                if (test.getDataProviderFunction() == null) {
                    String message = String.format("Data provider function [%s] cannot be found.", dataProvider);
                    throw new BallerinaException(message);
                }
            }
            for (String dependsOnFn : test.getDependsOnTestFunctions()) {
                if (!functions.stream().anyMatch(func -> func.getName().equals(dependsOnFn))) {
                    throw new BallerinaException("Cannot find the specified dependsOn function : " + dependsOnFn);
                }
                test.addDependsOnTestFunction(functions.stream().filter(e -> e.getName().equals(dependsOnFn))
                                                       .findFirst().get());
            }
        }

        
        suite.getMockFunctionNamesMap().forEach((id, functionName) -> {
            TesterinaFunction function = suite.getTestUtilityFunctions().stream().filter(e -> e.getName().equals
                    (functionName)).findFirst().get();
            suite.addMockFunctionObj(id, function);
        });

        suite.getBeforeSuiteFunctionNames().forEach(functionName -> {
            TesterinaFunction function = suite.getTestUtilityFunctions().stream().filter(e -> e.getName().equals
                    (functionName)).findFirst().get();
            suite.addBeforeSuiteFunctionObj(function);
        });

        suite.getAfterSuiteFunctionNames().forEach(functionName -> {
            TesterinaFunction function = suite.getTestUtilityFunctions().stream().filter(e -> e.getName().equals
                    (functionName)).findFirst().get();
            suite.addAfterSuiteFunctionObj(function);
        });

        suite.getBeforeEachFunctionNames().forEach(functionName -> {
            TesterinaFunction function = suite.getTestUtilityFunctions().stream().filter(e -> e.getName().equals
                    (functionName)).findFirst().get();
            suite.addBeforeEachFunctionObj(function);
        });

        suite.getAfterEachFunctionNames().forEach(functionName -> {
            TesterinaFunction function = suite.getTestUtilityFunctions().stream().filter(e -> e.getName().equals
                    (functionName)).findFirst().get();
            suite.addAfterEachFunctionObj(function);
        });

    }

Line commented on: throw new BallerinaException("Cannot find the specified dependsOn function : " + dependsOnFn);

Revised code:
private static void resolveFunctions(TestSuite suite) {
        List<TesterinaFunction> functions = suite.getTestUtilityFunctions();
        List<String> functionNames = functions.stream().map(testerinaFunction -> testerinaFunction.getName()).collect
                (Collectors.toList());
        for (Test test : suite.getTests()) {
            if (test.getTestName() != null && functionNames.contains(test.getTestName())) {
                test.setTestFunction(functions.stream().filter(e -> e.getName().equals(test
                        .getTestName())).findFirst().get());
            }

            if (test.getBeforeTestFunction() != null && functionNames.contains(test.getBeforeTestFunction())) {
                test.setBeforeTestFunctionObj(functions.stream().filter(e -> e.getName().equals(test
                        .getBeforeTestFunction())).findFirst().get());
            }

            if (test.getAfterTestFunction() != null && functionNames.contains(test.getAfterTestFunction())) {
                test.setAfterTestFunctionObj(functions.stream().filter(e -> e.getName().equals(test
                        .getAfterTestFunction())).findFirst().get());
            }

            if (test.getDataProvider() != null && functionNames.contains(test.getDataProvider())) {
                String dataProvider = test.getDataProvider();
                test.setDataProviderFunction(functions.stream().filter(e -> e.getName().equals(test.getDataProvider()
                )).findFirst().map(func -> {
                    
                    if (func.getbFunction().getRetParamTypes().length == 1) {
                        BType bType = func.getbFunction().getRetParamTypes()[0];
                        if (bType.getTag() == TypeTags.ARRAY_TAG) {
                            BArrayType bArrayType = (BArrayType) bType;
                            if (bArrayType.getElementType().getTag() != TypeTags.ARRAY_TAG) {
                                String message = String.format("Data provider function [%s] should return an array of" +
                                        " arrays.", dataProvider);
                                throw new BallerinaException(message);
                            }
                        } else {
                            String message = String.format("Data provider function [%s] should return an array of " +
                                    "arrays.", dataProvider);
                            throw new BallerinaException(message);
                        }
                    } else {
                        String message = String.format("Data provider function [%s] should have only one return type" +
                                ".", dataProvider);
                        throw new BallerinaException(message);
                    }
                    return func;
                }).get());

                if (test.getDataProviderFunction() == null) {
                    String message = String.format("Data provider function [%s] cannot be found.", dataProvider);
                    throw new BallerinaException(message);
                }
            }
            for (String dependsOnFn : test.getDependsOnTestFunctions()) {
                if (!functions.stream().parallel().anyMatch(func -> func.getName().equals(dependsOnFn))) {
                    throw new BallerinaException("Cannot find the specified dependsOn function : " + dependsOnFn);
                }
                test.addDependsOnTestFunction(functions.stream().filter(e -> e.getName().equals(dependsOnFn))
                                                       .findFirst().get());
            }
        }

        
        suite.getMockFunctionNamesMap().forEach((id, functionName) -> {
            TesterinaFunction function = suite.getTestUtilityFunctions().stream().filter(e -> e.getName().equals
                    (functionName)).findFirst().get();
            suite.addMockFunctionObj(id, function);
        });

        suite.getBeforeSuiteFunctionNames().forEach(functionName -> {
            TesterinaFunction function = suite.getTestUtilityFunctions().stream().filter(e -> e.getName().equals
                    (functionName)).findFirst().get();
            suite.addBeforeSuiteFunctionObj(function);
        });

        suite.getAfterSuiteFunctionNames().forEach(functionName -> {
            TesterinaFunction function = suite.getTestUtilityFunctions().stream().filter(e -> e.getName().equals
                    (functionName)).findFirst().get();
            suite.addAfterSuiteFunctionObj(function);
        });

        suite.getBeforeEachFunctionNames().forEach(functionName -> {
            TesterinaFunction function = suite.getTestUtilityFunctions().stream().filter(e -> e.getName().equals
                    (functionName)).findFirst().get();
            suite.addBeforeEachFunctionObj(function);
        });

        suite.getAfterEachFunctionNames().forEach(functionName -> {
            TesterinaFunction function = suite.getTestUtilityFunctions().stream().filter(e -> e.getName().equals
                    (functionName)).findFirst().get();
            suite.addAfterEachFunctionObj(function);
        });

    }