Search Header Logo
Mockito Tutorial: Learn mocking with 25 Junit Examples - Step 03: Stubbing Example - with Disadvantages of Stubbing

Mockito Tutorial: Learn mocking with 25 Junit Examples - Step 03: Stubbing Example - with Disadvantages of Stubbing

Assessment

Interactive Video

Information Technology (IT), Architecture

University

Practice Problem

Hard

Created by

Wayground Content

FREE Resource

The video tutorial introduces the concept of stubs in unit testing, explaining how to create and use them to test a ToDo business implementation. It covers the process of creating a stub, using it in tests, and the limitations of stubs, such as maintenance challenges and dynamic condition handling. The tutorial concludes by suggesting the use of mocks as a more dynamic alternative to stubs.

Read more

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a stub in the context of unit testing?

A type of database

A sample implementation used for testing

A real implementation of a service

A user interface component

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Why do we create a stub for the to-do service?

To improve the user interface

To replace the main code

To enhance database performance

To test the to-do business implementation

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the first step in setting up a unit test using a stub?

Create a to-do business implementation

Write a user manual

Create a new database

Implement a user interface

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of using assert equals in a unit test?

To create a new stub

To check if the test runs

To verify the expected and actual values

To delete unnecessary code

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What exercise is suggested to improve the test?

Add more stubs

Check the exact values in the list

Create a new user interface

Optimize the database

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a major limitation of using stubs?

They are too dynamic

They require constant maintenance

They are expensive

They are too fast

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens when a new method is added to the interface?

The stub needs to be manually updated

The test fails

The database crashes

The stub automatically updates

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?