AVLTree { public void insert(final T element) { if (element != null) { if (top == null) { top = new Node(element, null); } else { top.insert(element); } } } AVLTree(); void insert(final T element); boolean delete(final T element); boolean isEmpty(); int size(); Node getSmallest(); Node getLargest(); Node getNotSmaller(final T reference); Node getNotLarger(final T reference);  }
@Test public void testInsert() { int[] array = { 16, 13, 15, 14, 2, 0, 12, 9, 8, 5, 11, 18, 19, 17, 4, 7, 1, 3, 6, 10 }; AVLTree<Integer> tree = buildTree(array); Assert.assertEquals(array.length, tree.size()); for (int i = 0; i < array.length; ++i) { Assert.assertEquals(array[i], value(tree.getNotSmaller(new Integer(array[i])))); } checkOrder(tree); }