@Test public void shouldRemoveListNode() { ListNode<Integer> head = new ListNode<Integer>(0); ListNode<Integer> n1 = new ListNode<Integer>(1); ListNode<Integer> n2 = new ListNode<Integer>(2); head.setNext(n1); n1.setNext(n2); deleteNode.delete(n1); assertListContainsElements(new Integer[] { 0, 2 }, head); }
public void delete(ListNode node) { validateInputData(node); if (node.getNext() == null) { return; } ListNode next = node.getNext(); node.setData(next.getData()); node.setNext(next.getNext()); }
DeleteListNode { public void delete(ListNode node) { validateInputData(node); if (node.getNext() == null) { return; } ListNode next = node.getNext(); node.setData(next.getData()); node.setNext(next.getNext()); } }
DeleteListNode { public void delete(ListNode node) { validateInputData(node); if (node.getNext() == null) { return; } ListNode next = node.getNext(); node.setData(next.getData()); node.setNext(next.getNext()); }  }
DeleteListNode { public void delete(ListNode node) { validateInputData(node); if (node.getNext() == null) { return; } ListNode next = node.getNext(); node.setData(next.getData()); node.setNext(next.getNext()); }  void delete(ListNode node); }
DeleteListNode { public void delete(ListNode node) { validateInputData(node); if (node.getNext() == null) { return; } ListNode next = node.getNext(); node.setData(next.getData()); node.setNext(next.getNext()); }  void delete(ListNode node);  }