
Mockito Tutorial: Learn mocking with 25 Junit Examples - Step 05: Stubbing variations with Mockito - Argument Matchers &
Interactive Video
•
Information Technology (IT), Architecture
•
University
•
Practice Problem
•
Hard
Wayground Content
FREE Resource
Read more
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is one of the key features of Mockito that allows returning multiple values from a single method call?
Single return stubbing
Multiple return stubbing
Static method invocation
Dynamic method creation
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method is used in Mockito to specify the behavior of a mock when a method is called?
thenReturn
when
verify
mock
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In the context of mocking, what does the 'when' method do?
It throws an exception
It sets up the expected behavior of a method
It verifies the number of method calls
It initializes a mock object
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the significance of the '@Test' annotation in JUnit?
It throws an exception
It verifies the test results
It initializes a mock object
It marks a method as a test case
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the 'anyInt' argument matcher in Mockito?
To match any object type
To match any string value passed to a method
To match any integer value passed to a method
To match any boolean value
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How does Mockito handle a method call for which no behavior is stubbed?
It throws an exception
It returns a default value
It logs an error
It skips the method call
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the default behavior of Mockito when a method is not explicitly stubbed?
It throws a runtime exception
It returns a random value
It logs a warning
It returns null or default values
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?