@Test public void testPushFront() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushFront(5); assertEquals(1, dll.elements()); }
@Test public void testPopBackCount() throws InvalidAccessException, ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushBack(6); dll.pushBack(5); assertEquals(5, dll.popBack()); assertEquals(1, dll.elements()); }
@Test public void testElements() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushBack(6); dll.pushBack(5); dll.pushFront(1); dll.pushFront(2); assertEquals(4, dll.elements()); }
@Test public void testPopFrontCaunt() throws InvalidAccessException, ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushFront(5); dll.pushFront(6); dll.pushFront(7); assertEquals(7, dll.popFront()); assertEquals(2, dll.elements()); }
// No Exception @Test public void testPushFrontNoException() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); try { dll.pushFront(5); dll.pushFront(6); assertEquals(2, dll.elements()); } catch (ValueException ex) { fail("No Exception expected!"); } }
// no Exception @Test public void testDoubleLinkedList() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushFront(1); dll.pushFront(2); dll.pushFront(3); DoubleLinkedList dll2; try { dll2 = new DoubleLinkedList(dll); assertEquals(3, dll2.elements()); } catch (NullPointerException ex) { fail("No Exception expected"); } }
// no exception expected @Test public void testPushBackDoubleLinkedList() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushBack(5); dll.pushBack(6); DoubleLinkedList dll2 = new DoubleLinkedList(); dll2.pushBack(1); dll2.pushBack(2); dll2.pushBack(3); try { dll.pushBack(dll2); assertEquals(5, dll.elements()); } catch (ValueException ex) { fail("No Exception expected!"); } }
@Test public void testDoubleLinkedListEmpty() { DoubleLinkedList dll = new DoubleLinkedList(); assertEquals(0, dll.elements()); }