if (actual == null) {
return false;
}
int i = 0;
SerializableDoublyLinkedNode currNode = actual;
for (; i < 5; ++i) {
assertEquals("n" + Integer.toString(i), currNode.getData());
if (!currNode.getData().equals("n" + Integer.toString(i))) {
return false;
}
SerializableDoublyLinkedNode nextNode = currNode.getRightChild();
SerializableDoublyLinkedNode prevNode = currNode.getLeftChild();
assertNotNull("next node", nextNode);
assertNotNull("prev node", prevNode);
if (nextNode == null || prevNode == null) {
return false;
}
assertSame("A", currNode, nextNode.getLeftChild());
if (nextNode.getLeftChild() != currNode) {
return false;
}
assertSame("B", currNode, prevNode.getRightChild());
if (prevNode.getRightChild() != currNode) {
return false;
}
currNode = currNode.getRightChild();
if (currNode == actual) {