I'm new in unit testing . I've to test a public method which uses the following private method .
public void f1({some parameters}){
List<Vertex> rVertex = fn(vertexId, graphTraversalSource,2);
for (Vertex vertex : resultVertex) {
if (checkingForAProperty(vertex.id().toString())) {
// some operations
}
}
}
private List<Vertex> fn(String v, GraphTraversalSource g, int i) {
return g.V(v).repeat(in().dedup().simplePath()).until(loops().is(i)).toList();
}
I thought of the following (terrible) approach (Assume g is mocked here ) :
when (g.V(v)).then(X);
when (X.repeat(any)).then(Y);
when (Y.until(any)).then(Z);
But I could'nt decide how to do that . Any suggestions to do this will be really helpful.