#linkedlist remove implementation debug
1 messages · Page 1 of 1 (latest)
this is my remove implementation
*/
public void testRemoveIndex() {
Exception thrown1 = null;
try
{
bigListA.remove(200);
}
catch (Exception exception1)
{
thrown1 = exception1;
}
//checks whether an Exception was actually thrown
assertNotNull(thrown1);
//checks whether the right type of Exception was thrown
assertTrue(thrown1 instanceof IndexOutOfBoundsException);
Exception thrown2 = null;
try
{
bigListA.remove(-1);
}
catch (Exception exception2)
{
thrown2 = exception2;
}
//checks whether an Exception was actually thrown
assertNotNull(thrown2);
//checks whether the right type of Exception was thrown
assertTrue(thrown2 instanceof IndexOutOfBoundsException);
//Checking when no exception expected
}```
this is my junit test