@Test
public void testRemove()
{

    DoublyLinkedList<Integer> list = new DoublyLinkedList<Integer>();
    ListNode2<Integer> node1 = list.add(1);
    list.remove(node1);
    node1 = list.add(1);
    ListNode2<Integer> node2 = list.add(2);
    list.remove(node1);
    assertEquals(1, list.size());
    assertEquals(new Integer(2), list.first());
    assertEquals(node2, list.head());
    assertArrayEquals(new Integer[]{2}, list.toArray());
    list.remove(node2);
    assertIsEmpty(list);
    node1 = list.add(1);
    node2 = list.add(2);
    list.remove(node2);
    assertEquals(1, list.size());
    assertEquals(new Integer(1), list.first());
    assertEquals(node1, list.head());
    assertArrayEquals(new Integer[]{1}, list.toArray());
    node2 = list.add(2);
    list.add(3);
    assertEquals(3, list.size());
    assertArrayEquals(new Integer[]{1, 2, 3}, list.toArray());
    list.remove(node2);
    assertEquals(2, list.size());
    assertEquals(node1, list.tail());
    assertEquals(new Integer(3), list.last());
    assertArrayEquals(new Integer[]{1, 3}, list.toArray());
}