Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. List mockedList = mock(List.class);
  2.  
  3. Mockito.when(mockedList.get(0))
  4. .thenReturn("one")
  5. .thenReturn("two")
  6. .thenThrow(new RuntimeException());
  7.  
  8. System.out.println(mockedList.get(0)); // one
  9. System.out.println(mockedList.get(0)); // two
  10. System.out.println(mockedList.get(0)); // RuntimeExceptionが発生する
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement