### Question:
BinaryTimeTree { protected void nodeClear(BTreeNode<E> node) { if (node == null) { return; } if (node.getSubNodes() != null) { for (BTreeNode<E> subNode : node.getSubNodes()) { if (subNode != null) { nodeClear(subNode); } } node.getSubNodes().clear(); } if (node.getValues() != null) { node.getValues().clear(); } } BinaryTimeTree();  BinaryTimeTree(int maxValuesPerNode, int maxDepth); void clear(); int countInRange(TimeSpan range); CountReport countsInBins(TimeSpan overAllRange, int numberOfBins); TIntList countsInRanges(List<TimeSpan> countTimes); List<E> findInRange(TimeSpan range); boolean insert(E tsProvider); boolean insert(List<E> collection); int internalSize(BTreeNode<E> node); int maxValuesPerNodeInteral(BTreeNode<E> node, int maxValues); int queryMaxValuesPerNode(); int size();  }### Answer:
@Test public void testNodeClearWithSubnodes() { BTreeNode<TimeSpanProvider> node = new BTreeNode<>(); BTreeNode<TimeSpanProvider> subNode1 = new BTreeNode<>(); BTreeNode<TimeSpanProvider> subNode2 = new BTreeNode<>(); BTreeNode<TimeSpanProvider> subNode3 = new BTreeNode<>(); BTreeNode<TimeSpanProvider> subNode4 = new BTreeNode<>(); BTreeNode<TimeSpanProvider> subNode5 = new BTreeNode<>(); subNode1.getValues().add(createMock(TimeSpanProvider.class)); subNode1.getValues().add(createMock(TimeSpanProvider.class)); subNode2.getValues().add(createMock(TimeSpanProvider.class)); subNode2.getValues().add(createMock(TimeSpanProvider.class)); subNode2.getValues().add(createMock(TimeSpanProvider.class)); subNode3.getValues().add(createMock(TimeSpanProvider.class)); subNode3.getValues().add(createMock(TimeSpanProvider.class)); subNode5.setValues(null); node.setSubNodes(new ArrayList<>(Arrays.asList(subNode1, subNode2, subNode3, subNode4, subNode5))); node.setValues(new ArrayList<>(Arrays.asList(createMock(TimeSpanProvider.class), createMock(TimeSpanProvider.class)))); myTestObject.nodeClear(node); assertTrue(node.getValues().isEmpty()); assertTrue(node.getSubNodes().isEmpty()); }
@Test public void testNodeClearWithNullValues() { BTreeNode<TimeSpanProvider> node = new BTreeNode<>(); node.setValues(null); node.setSubNodes(null); myTestObject.nodeClear(node); assertNull(node.getValues()); assertNull(node.getSubNodes()); }
@Test public void testNodeClearNull() { myTestObject.nodeClear(null); }