How to test Single Linked List using Assert.assertEquals()

i am trying to test singly linked list using Assert.assertEqual(expected, actual) the linked list has a node index and a value. how can i use Assert.assertEquals() to test it.

This is my code

@Test

void nonEmptyTest() throws ListAccessError {

SingleLinkedList list = new SingleLinkedList();

SingleLinkedList expList = new SingleLinkedList();

list.add(0,10);

list.add(1,20);

list.add(2,30);

expList.add(0,10);

expList.add(1,20);

expList.add(2,30);

Assert.assertEquals(expList, list);

}...

Read More »

By: StackOverFlow - 5 days ago

Related Posts