5
Mockito ile alaylardan istisnalar attı
Alaycı nesnelerimden biri belirli bir yöntem çağrıldığında kontrol edilen bir istisna atmaya çalışıyorum. Aşağıdakileri deniyorum. @Test(expectedExceptions = SomeException.class) public void throwCheckedException() { List<String> list = mock(List.class); when(list.get(0)).thenThrow(new SomeException()); String test = list.get(0); } public class SomeException extends Exception { } Ancak, bu aşağıdaki hatayı üretir. org.testng.TestException: Expected exception com.testing.MockitoCheckedExceptions$SomeException but …