use of fr.neatmonster.nocheatplus.components.data.checktype.CheckTypeTree.CheckTypeTreeNodeFactory in project NoCheatPlus by NoCheatPlus.
the class TestCheckTypeTree method testCreationCompleteness.
@Test
public void testCreationCompleteness() {
CheckTypeTree<TestNode> tree = new CheckTypeTree<TestNode>() {
@Override
protected TestNode newNode(CheckType checkType, TestNode parent, CheckTypeTreeNodeFactory<TestNode> factory) {
return new TestNode(checkType, parent, factory);
}
};
for (CheckType checkType : CheckType.values()) {
TestNode node = tree.getNode(checkType);
CheckType rct = node.getCheckType();
if (rct != checkType) {
fail("Bad check type, expext " + checkType + ", got instead: " + rct);
}
if (rct.getParent() != null && node.getParent().getCheckType() != rct.getParent()) {
fail("Wrong type of parent.");
}
if (node.getChildren().size() != CheckTypeUtil.getDirectChildren(checkType).size()) {
fail("Wrong size of children.");
}
}
if (tree.getNode(null) != null) {
fail("tree.getNode(null) returns a non null node for CheckType: " + tree.getNode(null).getCheckType());
}
}
Aggregations