Last active
July 11, 2019 14:09
-
-
Save donchan922/42f3f47180e037aba330272b60e4d429 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") | |
.thenReturn("three"); | |
// 短縮形 | |
Mockito.when(mockedList.get(0)).thenReturn("one", "two", "three"); | |
System.out.println(mockedList.get(0)); // one | |
System.out.println(mockedList.get(0)); // two | |
System.out.println(mockedList.get(0)); // three | |
System.out.println(mockedList.get(0)); // three |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment