How can i write a JUnit test for this method
public E get(int index) { if(index< 0 || index>=array.length) throw new IndexOutOfBoundsException(); return array[index]; }
i tried this test but it return NullPointerException
@Test
public void test() {
int expected_value = 7;
int actual_value = arr.get(7);
assertEquals("Error failed:",expected_value, actual_value);
}
Aucun commentaire:
Enregistrer un commentaire