Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement