coder coder - 3 months ago 18
Java Question

How many tests should I apply to test doubly Linked-list?

I have a doubly linked list

int
. I want to test
Get()
method:

public E get (int index)


how many testes should I implement in JUnit to Cover fully cases ?

Thank you and hope to have answer soon.

Answer Source

I think you can follow all tests below:

  1. Test Get(0)from an empty list.
  2. Test Get(-1) from a list with 01 element
  3. Test Get(0) from a list with 1 element
  4. Test Get(1) from a list with 2 element.