import org.junit.*;

public class NodeTest {

  @Test
  public void testAppendToTailToOneNode() {
    Node head      = new Node(10);
    Node afterHead = new Node(15);
    head.appendToTail(afterHead);

    Assert.assertEquals(head.next, afterHead);
  }

  @Test
  public void testAppendToTailToManyNodes() {
    Node head       = new Node(10);
    head.appendToTail(new Node(15));
    head.appendToTail(new Node(20));
    head.appendToTail(new Node(25));
    Node end        = new Node(30);
    head.appendToTail(end);

    Assert.assertEquals(head.next.next.next.next, end);
  }

  @Test
  public void testOddNodePalindrome() {
    Node head       = new Node(10);
    head.appendToTail(new Node(15));
    head.appendToTail(new Node(20));
    head.appendToTail(new Node(15));
    head.appendToTail(new Node(10));

    Assert.assertTrue(head.isPalindrome());
  }

  @Test
  public void testEvenNodePalindrome() {
    Node head       = new Node(10);
    head.appendToTail(new Node(15));
    head.appendToTail(new Node(15));
    head.appendToTail(new Node(10));

    Assert.assertTrue(head.isPalindrome());
  }

  @Test
  public void testInvalidPalindrome() {
    Node head       = new Node(10);
    head.appendToTail(new Node(15));
    head.appendToTail(new Node(20));
    head.appendToTail(new Node(15));

    Assert.assertFalse(head.isPalindrome());
  }

  @Test
  public void testOneNodePalindrome() {
    Node head      = new Node(10);

    Assert.assertTrue(head.isPalindrome());
  }

  @Test
  public void testOneNodeFindMedian() {
    Node head       = new Node(10);

    Assert.assertEquals(head.findMedianElement(), head);
  }

  @Test
  public void testOddNodeFindMedian() {
    Node medianNode = new Node(10);

    Node head       = new Node(5);
    head.appendToTail(medianNode);
    head.appendToTail(new Node(15));

    Assert.assertEquals(head.findMedianElement(), medianNode);
  }

  @Test
  public void testEvenNodeFindMedian() {
    Node medianNode = new Node(10);

    Node head       = new Node(5);
    head.appendToTail(medianNode);
    head.appendToTail(new Node(15));
    head.appendToTail(new Node(20));

    Assert.assertEquals(head.findMedianElement(), medianNode);
  }

  @Test
  public void testFindListLengthForOneNode() {
    Node head       = new Node(10);

    Assert.assertEquals(head.getLength(), 1);
  }

  @Test
  public void testFindListLengthForManyNodes() {
    Node head       = new Node(10);
    head.appendToTail(new Node(15));
    head.appendToTail(new Node(20));
    head.appendToTail(new Node(25));
    head.appendToTail(new Node(30));
    head.appendToTail(new Node(35));
    head.appendToTail(new Node(40));

    Assert.assertEquals(head.getLength(), 7);
  }

  @Test
  public void testCircularListOneNode() {
    Node head       = new Node(10);
    head.appendToTail(head);

    Assert.assertTrue(head.isCircular());
  }

  @Test
  public void testCircularListManyNodes() {
    Node head       = new Node(10);
    head.appendToTail(new Node(15));
    head.appendToTail(new Node(20));
    head.appendToTail(new Node(25));
    head.appendToTail(new Node(30));
    head.appendToTail(new Node(35));
    head.appendToTail(head);

    Assert.assertTrue(head.isCircular());
  }

  @Test
  public void testNonCircularOneNode() {
    Node head       = new Node(10);

    Assert.assertFalse(head.isCircular());
  }

  @Test
  public void testDeleteFirstNode() {
    Node head       = new Node(10);
    Node secondNode = new Node(15);

    head.appendToTail(secondNode);
    head.appendToTail(new Node(20));
    head = head.delete(head, 10);

    Assert.assertEquals(head, secondNode);
  }
}

@@ -2755,38 +2755,32 @@
 %7B%0A    Node head 
-      
 = new Node(10);%0A
@@ -3261,38 +3261,32 @@
 %7B%0A    Node head 
-      
 = new Node(10);%0A
@@ -3400,61 +3400,362 @@
 d   
-    = new Node(10);%0A    Node secondNode = new Node(15
+= new Node(10);%0A    Node second = new Node(15);%0A%0A    head.appendToTail(second);%0A    head.appendToTail(new Node(20));%0A%0A    head = head.delete(head, head.data);%0A%0A    Assert.assertEquals(head, second);%0A  %7D%0A%0A  @Test%0A  public void testDeleteLastNode() %7B%0A    Node head       = new Node(10);%0A    Node secondLast = new Node(25);%0A    Node last       = new Node(30
 );%0A%0A
@@ -3776,26 +3776,28 @@
 dToTail(
-secondNode
+new Node(15)
 );%0A    h
@@ -3820,32 +3820,97 @@
 (new Node(20));%0A
+    head.appendToTail(secondLast);%0A    head.appendToTail(last);%0A%0A
     head = head.
@@ -3922,18 +3922,25 @@
 e(head, 
-10
+last.data
 );%0A%0A    
@@ -3963,24 +3963,354 @@
 als(
-head, secondNode
+secondLast.next, null);%0A  %7D%0A%0A  @Test%0A  public void testDeleteNodeAffectsLength() %7B%0A    Node head       = new Node(10);%0A    head.appendToTail(new Node(15));%0A    head.appendToTail(new Node(20));%0A    head.appendToTail(new Node(25));%0A    head.appendToTail(new Node(30));%0A%0A    head = head.delete(head, 25);%0A%0A    Assert.assertEquals(head.getLength(), 4
 );%0A 

Add test coverage for delete method.