I\'m trying to have one of my mocked objects throw a checked Exception when a particular method is called. I\'m trying the following.
@Test(expectedException
This works for me in Kotlin:
when(list.get(0)).thenThrow(new ArrayIndexOutOfBoundsException());
Note : Throw any defined exception other than Exception()