Testing our code
GDS also provides a utility for writing unit tests for our code. We are going to test both implementations, PageRank
and PageRankTol
, starting with the former.
Test for the PageRank class
Let’s get started and detail the code block by block:
- First, we must define our test class, called
PageRankTest
:@GdlExtension
class PageRankTest {
- Then, we must create a graph object from a Cypher string, using
NATURAL
orientation for the relationship (the default one):@GdlGraph(orientation = Orientation.NATURAL)
private static final String TEST_GRAPH =
"CREATE" +
" (A:Node)" +
"...