Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What is a mock in the context of unit testing?
Think about why we don't want to use real objects in unit tests.
Which Mockito annotation is used to create a mock object?
This annotation is used for indicating mock instances.
What does the @Mock annotation do in Mockito?
Think about the purpose of the @Mock annotation.
True or False: The when() method in Mockito is used to verify that a method was called.
Consider which method is actually used for verification.
Create a unit test scenario that demonstrates mocking by using Mockito. Include at least one mock, a stubbing method call, an injecting mock, and a verification.
Think of the sequence: define a mock, inject it into the controller, and verify the interaction.
Why is it crucial to ensure mocks behave as expected? Describe this in the context of a testing scenario involving a data repository.
Reflect on how mocking impacts test reliability and accuracy.
5 more questions in this section. Enroll free to practise them all.
Enroll free