コード例 #1
0
 @Test
 public void testInsert() {
   myList.insert(new Entity("Someone", 50));
   MyNode head = myList.getHead();
   assertEquals("(Someone, 50)", head.toString());
   myList.insert(new Entity("Somebody", 100));
   head = myList.getHead();
   assertEquals("(Somebody, 100)", head.toString());
 }
コード例 #2
0
  @Test
  public void testDetele() {
    myList.insert(new Entity("Someone", 50));
    myList.insert(new Entity("Somebody", 100));
    myList.insert(new Entity("ThirdParty", 80));
    myList.delete(myList.getHead().getRight());

    assertEquals("(ThirdParty, 80)", myList.getHead().toString());
    assertEquals("(Someone, 50)", myList.getHead().getRight().toString());

    myList.delete(myList.getHead());
    assertEquals("(Someone, 50)", myList.getHead().toString());
  }
コード例 #3
0
 @Test
 public void testIterator() {
   MyIterator it = (MyIterator) myList.iterator();
   assertNotNull(it);
 }