Created
July 11, 2019 14:04
-
-
Save donchan922/5c02ed682fec5958edbdc0b49b4c90bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List mockedList = mock(List.class); | |
Mockito.when(mockedList.get(0)) | |
.thenReturn("one") | |
.thenReturn("two") | |
.thenThrow(new RuntimeException()); | |
System.out.println(mockedList.get(0)); // one | |
System.out.println(mockedList.get(0)); // two | |
System.out.println(mockedList.get(0)); // RuntimeExceptionが発生する |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment