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);
    Node afterHead = new Node(15);

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

  @Test
  public void testOddNodeFindMedian() {
    Node head      = new Node(10);
    Node afterHead = new Node(15);

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

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

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

  @Test
  public void testFindListLengthForManyNodes() {
    Node head      = new Node(10);
    Node afterHead = new Node(15);

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

@@ -1541,32 +1541,33 @@
  Node head      
+ 
 = new Node(10);%0A
@@ -1566,34 +1566,151 @@
 de(10);%0A
+%0A
     
-Node afterHead
+Assert.assertEquals(head.findMedianElement(), head.data);%0A  %7D%0A%0A  @Test%0A  public void testOddNodeFindMedian() %7B%0A    Node head      
  = new N
@@ -1717,48 +1717,136 @@
 ode(
-1
 5);%0A
-%0A    head.appendToTail(afterHead
+    head.appendToTail(new Node(10));%0A    head.appendToTail(new Node(15));%0A%0A    Node medianNode = head.findMedianElement(
 );%0A
+%0A
     
@@ -1869,36 +1869,35 @@
 als(
-head.next, afterHead
+medianNode.data, 10
 );%0A  %7D%0A%0A
   @T
@@ -1884,32 +1884,33 @@
 data, 10);%0A  %7D%0A%0A
+%0A
   @Test%0A  public
@@ -1911,35 +1911,36 @@
 public void test
-Odd
+Even
 NodeFindMedian()
@@ -1953,32 +1953,33 @@
  Node head      
+ 
 = new Node(10);%0A
@@ -1982,33 +1982,71 @@
 0);%0A    
-Node afterHead = 
+head.appendToTail(new Node(15));%0A    head.appendToTail(
 new Node
@@ -2038,38 +2038,38 @@
 ToTail(new Node(
-15
+20)
 );%0A
-%0A
     head.appendT
@@ -2070,36 +2070,89 @@
 ppendToTail(
-afterHead
+new Node(25));%0A%0A    Node medianNode = head.findMedianElement(
 );%0A
+%0A
     Assert.a
@@ -2163,36 +2163,30 @@
 tEquals(
-head.next, afterHead
+medianNode, 15
 );%0A  %7D%0A%0A

Refactor some test cases.