@Test public void testSearchTrue() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushBack(6); dll.pushBack(5); dll.pushFront(new Integer(3)); dll.pushFront(2); assertEquals(true, dll.search(new Integer(3))); }
@Test public void testClear() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushFront(5); dll.pushFront(6); dll.pushFront(7); dll.clear(); assertEquals(0, 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()); }
// null exception expected @Test public void testPushFrontNullPointerException() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); try { dll.pushFront((Comparable) null); dll.pushFront("String"); } catch (NullPointerException ex) { return; } fail("Exception expected!"); }
// exception expected @Test public void testPushFrontException() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); try { dll.pushFront(5); dll.pushFront("String"); } catch (ValueException ex) { return; } fail("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"); } }
// null exception expected @Test public void testPushFrontDoubleLinkedListNullPointerException() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushFront(5); dll.pushFront(6); DoubleLinkedList dll2 = new DoubleLinkedList(); dll2.pushFront("String"); dll2.pushFront("ssdf"); dll2.pushFront("sdf"); try { dll.pushFront((DoubleLinkedList) null); } catch (NullPointerException ex) { return; } fail("Exceptione expected!"); }
// No exception expected @Test public void testPushFrontDoubleLinkedList() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushFront(5); dll.pushFront(6); DoubleLinkedList dll2 = new DoubleLinkedList(); dll2.pushFront(1); dll2.pushFront(2); dll2.pushFront(3); try { dll.pushFront(dll2); assertEquals(3, dll.elements()); } catch (ValueException ex) { fail("No Exceptione expected!"); } }
@Test public void testSearchFalse() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushBack(6); dll.pushBack(5); dll.pushFront(3); dll.pushFront(2); assertEquals(false, dll.search(4)); }
@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 testEqualsFalse() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushBack(6); dll.pushBack(5); DoubleLinkedList dll2 = new DoubleLinkedList(); dll2.pushFront(6); dll2.pushFront(5); assertEquals(false, dll.equals(dll2)); }
// no Exception expected @Test public void testPeekFront() throws InvalidAccessException, ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushFront(5); dll.pushFront(6); try { assertEquals(6, dll.peekFront()); } catch (InvalidAccessException ex) { fail(ex.getMessage()); } }
// no Exception expected @Test public void testSearchNoException() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushBack(6); dll.pushBack(5); dll.pushFront(3); dll.pushFront(2); try { assertEquals(false, dll.search(4)); } catch (NullPointerException ex) { fail("No Exception expected!"); } }
// Exception expected @Test public void testSearchException() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushBack(6); dll.pushBack(5); dll.pushFront(3); dll.pushFront(2); try { assertEquals(false, dll.search("String")); } catch (ValueException ex) { return; } fail("Exception expected!"); }
// Exception expected @Test public void testEqualsException() throws ValueException { DoubleLinkedList dll = new DoubleLinkedList(); dll.pushBack(6); dll.pushBack(5); DoubleLinkedList dll2 = new DoubleLinkedList(); dll2.pushFront(6); dll2.pushFront(5); try { assertEquals(false, dll.equals(null)); } catch (NullPointerException ex) { return; } fail("Exception expected!"); }