Database Reference
In-Depth Information
graphDb.createNode(DynamicLabel.label(testLabel));
node.setProperty(testKey, testValue);
transaction.success();
}
//Check the Assertion
assertThat(node).hasLabel(DynamicLabel.label(testLabel)).hasProperty(testKey,
testValue);
}
The preceding code first creates a node with properties in the test Neo4j database and next
it uses the assertion provided by AssertJ to check whether the node is successfully created
with the provided labels and properties.
The following assertions are provided by AssertJ:
• Node assertions
• Path assertions
• Relationship assertions
• PropertyContainer assertions
In this section, you have discussed and learned the importance of unit testing while work-
ing with Neo4j and the various frameworks available for unit testing the code developed
for creating and traversing Neo4j graphs.
Let's move ahead to the next section where we will talk about Java APIs exposed and
available in Neo4j.
Search WWH ::




Custom Search