### Question:
LinkedCell { void insertNext(final LinkedCell<T> cell) { if (this.next != null) { this.next.previous = cell; } cell.next = this.next; cell.previous = this; this.next = cell; } LinkedCell(final T value); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj); static void main(final String[] args);  }### Answer:
@Test public void testInsertNext() { final int length = 10; final List<Integer> answer = new LinkedList<>(); final LinkedCell<Integer> cell = new LinkedCell<>(0); answer.add(0); for (int i = 1; i < length; i++) { cell.insertNext(new LinkedCell<>(i)); answer.add(1, i); } LinkedCell<Integer> cur = cell; Assert.assertNull(cur.getPrevious()); for (int i = 0; i < answer.size(); i++) { Assert.assertEquals(answer.get(i), cur.get()); cur = cur.getNext(); } Assert.assertNull(cur); cell.getNext().insertNext(new LinkedCell<>(length)); answer.add(2, length); cur = cell; Assert.assertNull(cur.getPrevious()); for (int i = 0; i < answer.size(); i++) { Assert.assertEquals(answer.get(i), cur.get()); cur = cur.getNext(); } Assert.assertNull(cur); for (cur = cell; cur.getNext() != null; cur = cur.getNext()) { } cur.insertNext(new LinkedCell<>(length + 1)); answer.add(length + 1); cur = cell; Assert.assertNull(cur.getPrevious()); for (int i = 0; i < answer.size(); i++) { Assert.assertEquals(answer.get(i), cur.get()); cur = cur.getNext(); } Assert.assertNull(cur); }