Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
What is a mock in unit testing?
Think about why we would want to isolate parts of our code when testing.
What annotation do we use to create a mock in Mockito?
This annotation signifies a variable that will not hold a real instance.
What does the @Mock annotation do in Mockito?
What action does this annotation perform specifically?
True or False: Using mocks allows for testing components in isolation.
Think about the purpose of mocks in testing frameworks.
Write a complete JUnit test case that uses Mockito to isolate a service class and verify its interactions.
Consider how to structure your test class and remember to use assertions after invoking the method under test.
Describe a scenario in which using mocks could lead to misleading results in unit testing, and how to mitigate that risk.
Think about how too much reliance on mocks might obscure real issues in dependencies.
7 more questions in this section. Enroll free to practise them all.
Enroll free