public void testCanIncreaseOneLeafSize() {
BasicTreeBranchPart part;
TreeBranchPartState partState = CoreDataCreatorForTests.createSpecificTreeBranchPartState();
partState.setEnergy(new BigDecimal(19));
part = new BasicTreeBranchPart(new MockUniverse(), partState);
assertFalse(part.canIncreaseOneLeafSize());
partState.setEnergy(new BigDecimal(20));
part = new BasicTreeBranchPart(new MockUniverse(), partState);
assertTrue(part.canIncreaseOneLeafSize());
// set all the leaves at their maximum size, so that they can not be increased anymore
for (TreeLeafState leafState : partState.getLeaveStates()) {
TreeLeaf3DState leaf3dState = leafState.getLeaf3DState();
Point3dState initialEndPoint1 = leaf3dState.getInitialEndPoint1();
leaf3dState.setEndPoint1(new Point3dState(initialEndPoint1.getX() * 10, initialEndPoint1.getY() * 10,
initialEndPoint1.getZ() * 10));
Point3dState initialEndPoint2 = leaf3dState.getInitialEndPoint2();
leaf3dState.setEndPoint2(new Point3dState(initialEndPoint2.getX() * 10, initialEndPoint2.getY() * 10,
initialEndPoint2.getZ() * 10));
}
part = new BasicTreeBranchPart(new MockUniverse(), partState);
assertFalse(part.canIncreaseOneLeafSize());
// reset the end point 1 of leaf 1, so that it can be increased again
partState.getLeaveStates().get(0).getLeaf3DState().setEndPoint1(
partState.getLeaveStates().get(0).getLeaf3DState().getInitialEndPoint1());
part = new BasicTreeBranchPart(new MockUniverse(), partState);
assertTrue(part.canIncreaseOneLeafSize());
}