Mockito Tutorial: Learn mocking with 25 Junit Examples - Step 14: Theory: Why does Mockito not allow stubbing final & pr

Mockito Tutorial: Learn mocking with 25 Junit Examples - Step 14: Theory: Why does Mockito not allow stubbing final & pr

Assessment

Interactive Video

Information Technology (IT), Architecture

University

Hard

Created by

Quizizz Content

FREE Resource

The video tutorial discusses the limitations of Mockito, such as its inability to mock private, final, and static methods, which is intended to promote good design and testing practices. It explores the design choices made by the creators of Mockito and compares it with other frameworks like PowerMock and EasyMock. The tutorial provides resources for further understanding and highlights the importance of testing public interfaces.

Read more

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Why does Mockito not allow mocking of private methods?

To allow for more flexible design

To make testing more complex

Because it is technically impossible

To ensure that only public interfaces are tested

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a reason given for not supporting static method mocking in Mockito?

Static methods are considered bad design in object-oriented programming

Static methods are too complex to mock

Static methods are rarely used

Static methods are always thread-safe

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which framework can be used with Mockito to mock final classes and static methods?

JUnit 5

TestNG

PowerMock

JUnit

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is one advantage of Mockito over EasyMock according to the transcript?

Mockito supports more languages

Mockito has better readability of code

Mockito is faster

Mockito is more secure

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is suggested to better understand the differences between Mockito and EasyMock?

Using both in a project

Comparing the code examples of both

Reading the official documentation of both

Attending a workshop on both