### Question:
DoublyLinkedList { public synchronized void insert(Monom val, boolean deleteImmediately) { Node newNode = new Node(val, null, null); Node crrNode, nextNode; boolean ins = false; if (start == null) start = newNode; else if (val.getExponent() > start.getData().getExponent()) { newNode.setLinkNext(start); start.setLinkPrev(newNode); start = newNode; } else if (val.getExponent() == start.getData().getExponent()) { start.addCoefficient(val.getCoefficient()); if (start.isCoefficientZero() && deleteImmediately) { delete(start); } return; } else { crrNode = start; nextNode = start.getLinkNext(); while (nextNode != null) { if (val.getExponent() < crrNode.getData().getExponent() && val.getExponent() > nextNode.getData().getExponent()) { crrNode.setLinkNext(newNode); newNode.setLinkPrev(crrNode); newNode.setLinkNext(nextNode); nextNode.setLinkPrev(newNode); ins = true; break; } if (val.getExponent() == nextNode.getData().getExponent()) { nextNode.addCoefficient(val.getCoefficient()); ins = true; size--; if (nextNode.isCoefficientZero() && deleteImmediately) { delete(nextNode); } break; } crrNode = nextNode; nextNode = nextNode.getLinkNext(); } if (!ins) { crrNode.setLinkNext(newNode); newNode.setLinkPrev(crrNode); } } size++; } DoublyLinkedList(); boolean isEmpty(); int getSize(); synchronized void insert(Monom val, boolean deleteImmediately); void display();  }### Answer:
@Test public void insert() { DoublyLinkedList linkedList = new DoublyLinkedList(); linkedList.insert(new Monom(1,100)); assert (linkedList.getSize() == 1); linkedList.display(); linkedList.insert(new Monom(1,99)); assert (linkedList.getSize() == 2); linkedList.display(); linkedList.insert(new Monom(1,99)); assert (linkedList.getSize() == 2); linkedList.display(); linkedList.insert(new Monom(-2,99)); assert (linkedList.getSize() == 1); linkedList.display(); }