Test
[Mockito] Mockito API
dragonSilver
2014. 2. 1. 13:41
Mockito
Mockito API (링크)
- Let’s verify some behaviour!
- How about some stubbing?
- Argument matchers
- Verifying exact number of invocations / at least once / never
- Stubbing void methods with exceptions
- Verification in order
- Making sure interaction(s) never happened on mock
- Finding redundant invocations
- Shorthand for mocks creation - @Mock annotation
- Stubbing consecutive calls (iterator-style stubbing)
- Stubbing with callbacks
- doThrow()|doAnswer()|doNothing()|doReturn() family of methods mostly for stubbing voids
- Spying on real objects
- Changing default return values of unstubbed invocations (Since 1.7)
- Capturing arguments for further assertions (Since 1.8.0)
- Real partial mocks (Since 1.8.0)
- Resetting mocks (Since 1.8.0)
- Troubleshooting & validating framework usage (Since 1.8.0)
- Aliases for behavior driven development (Since 1.8.0)
- Serializable mocks (Since 1.8.1)
- New annotations: @Captor, @Spy, @InjectMocks (Since 1.8.3)
- (New) Verification with timeout (Since 1.8.5)
Mockito API 한글 (링크)