Beispiel #1
0
  @Test
  public void testNumLinkedListEquals() {
    NumLinkedList listA = new NumLinkedList();
    NumLinkedList listB = new NumLinkedList();
    NumLinkedList listC = new NumLinkedList();

    listA.add(1.0);
    listA.add(3.0);

    assertFalse(
        "EQUALS method should return FALSE, when two lists are not the same.", listA.equals(listB));

    listB.add(1.0);
    listB.add(3.0);

    assertTrue(
        "EQUALS method should return TRUE, when two lists are the same.", listA.equals(listB));

    listC.add(3.0);
    listC.add(1.0);

    assertFalse(
        "EQUALS method should return FALSE, even if the same "
            + "numbers are in different order in two lists.",
        listA.equals(listC));
  }