Setup Mocking

Setup Mocking

Professional Development

26 Qs

quiz-placeholder

Similar activities

JS вс 12.01, пн вз 13.01, вт 14.01

JS вс 12.01, пн вз 13.01, вт 14.01

Professional Development

21 Qs

OCA Unit 1

OCA Unit 1

11th Grade - Professional Development

23 Qs

Android Quiz

Android Quiz

10th Grade - Professional Development

25 Qs

Use Mockito with JUnit5

Use Mockito with JUnit5

Professional Development

31 Qs

98.Test Register User

98.Test Register User

Professional Development

21 Qs

TEST IT02-IT03-IT04

TEST IT02-IT03-IT04

Professional Development

29 Qs

Básico de JS

Básico de JS

Professional Development

21 Qs

Cloud Native

Cloud Native

Professional Development

23 Qs

Setup Mocking

Setup Mocking

Assessment

Quiz

Computers

Professional Development

Hard

Created by

ANIL KUMAR

FREE Resource

26 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How to create a mock in Java?
a) Create fake objects from real classes/interfaces.
b) Call MockitoAnnotations.initMocks(this).
c) Set up the JAVA environment.
d) Use the Mockito.mock() method.

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How to initialize a mock object in Java?
a) Call MockitoAnnotations.initMocks(this).
b) Create an interface with unimplemented methods.
c) Use @RunWith(MockitoJUnitRunner.class).
d) Set up the CLASSPATH variable.

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How do I set up Mockito?
a) Download the Mockito-All archive.
b) Verify Java installation.
c) Set up the JAVA environment.
d) Set up the JUnit environment.

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How does mocking work in Java?
a) Mocking removes external dependencies from a unit test.
b) Mocking involves creating fake objects.
c) Mocking verifies method execution and arguments.
d) Mocking simulates behavior using Mockito annotations.

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How to implement Mockito in Java?
a) Create an interface with unimplemented methods.
b) Set up the Mockito environment.
c) Use the Mockito.mock() method.
d) Download the Mockito-All archive.

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the difference between @InjectMocks and @Autowired?
a) @InjectMocks injects dependencies into non-test classes.
b) @Autowired replaces dependencies in a test class.
c) @InjectMocks is used in Spring framework.
d) @Autowired is used in Mockito framework.

7.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Can I mock a class in Java?
a) Yes, using the Mockito.mock() method.
b) No, Mockito only mocks interfaces.
c) Yes, using the @Autowired annotation.
d) No, mocking is not supported in Java.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?