Example #1
0
  @Test
  public void removeANotFoundElement() {
    tree.remove(0);

    assertThat(tree.size(), is(6));

    List<Integer> list = tree.preorder();
    List<Integer> expected = Arrays.asList(2, 1, 4, 3, 5, 6);
    assertThat(list, is(equalTo(expected)));
  }
Example #2
0
  @Test
  public void removeElement2() {
    tree.remove(2);

    assertThat(tree.size(), is(5));

    List<Integer> list = tree.preorder();
    List<Integer> expected = Arrays.asList(3, 1, 5, 4, 6);
    assertThat(list, is(equalTo(expected)));
  }
Example #3
0
 @Test
 public void checkPreorder() {
   List<Integer> list = tree.preorder();
   List<Integer> expected = Arrays.asList(2, 1, 4, 3, 5, 6);
   assertThat(list, is(equalTo(expected)));
 }