@Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNegativePositionsToSearch() { BinaryNode<Integer> tree = new BinaryNode<Integer>(1); findMinNumberAtPosition.find(tree, -1); }
public Integer find(BinaryNode<Integer> root, int position) { validateInputData(root, position); List<BinaryNode<Integer>> orderedElements = getOrderedElements(root); validatePosition(position, orderedElements); return orderedElements.get(position - 1).getData(); }
FindMinNumberAtPosition { public Integer find(BinaryNode<Integer> root, int position) { validateInputData(root, position); List<BinaryNode<Integer>> orderedElements = getOrderedElements(root); validatePosition(position, orderedElements); return orderedElements.get(position - 1).getData(); } }
FindMinNumberAtPosition { public Integer find(BinaryNode<Integer> root, int position) { validateInputData(root, position); List<BinaryNode<Integer>> orderedElements = getOrderedElements(root); validatePosition(position, orderedElements); return orderedElements.get(position - 1).getData(); } FindMinNumberAtPosition(); }
FindMinNumberAtPosition { public Integer find(BinaryNode<Integer> root, int position) { validateInputData(root, position); List<BinaryNode<Integer>> orderedElements = getOrderedElements(root); validatePosition(position, orderedElements); return orderedElements.get(position - 1).getData(); } FindMinNumberAtPosition(); Integer find(BinaryNode<Integer> root, int position); }
FindMinNumberAtPosition { public Integer find(BinaryNode<Integer> root, int position) { validateInputData(root, position); List<BinaryNode<Integer>> orderedElements = getOrderedElements(root); validatePosition(position, orderedElements); return orderedElements.get(position - 1).getData(); } FindMinNumberAtPosition(); Integer find(BinaryNode<Integer> root, int position);  }