Skip to content

MockReset is extremely slow for large project in 1.5.x branch #14260

Closed
@longwa

Description

@longwa

Spring Boot 1.5.15

The line:

if (ClassUtils.isPresent("org.mockito.internal.util.MockUtil", null)) {

...checks for the presence of Mockito on every call. This is executed before AND after each test for every bean in the context.

In spring-boot 2.0 this has already been refactored to check once in the ResetMocksTestExecutionListener and store the result in a static variable. It would be nice if this could be back ported to 1.5.x as well.

Our project has about 1500 beans and we run around 8,300 tests. This results in over 12 million calls to this method. Stubbing out the ResetMocksTestExecutionListener improves performance by about 10x.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions