'Convert a test requirement paths into junit5 test class

This is my function and I draw the graph then I found the test requirement paths for edge coverage criteria and now I want to convert those paths a Junit 5 test class

int indexOf(Integer n, List<Integer> path) {
    for (int i = 0; i<path.size(); i++) {
        if (path.get(i).equals(n))
            return i;
    }
    return -1;
}

Suppose that I have 5 nodes from 1 to 5 and those are my test path requirements:

[1,2,3,4]
[1,2,5] 

Could anyone help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source