Package org.mockito.junit
Class MockitoJUnitRunner.Silent
java.lang.Object
org.junit.runner.Runner
org.mockito.junit.MockitoJUnitRunner
org.mockito.junit.MockitoJUnitRunner.Silent
- All Implemented Interfaces:
Describable
,Filterable
- Enclosing class:
MockitoJUnitRunner
This Mockito JUnit Runner implementation *ignores*
stubbing argument mismatches (
MockitoJUnitRunner.StrictStubs
)
and *does not detect* unused stubbings.
The runner remains 'silent' even if incorrect stubbing is present.
It is an equivalent of Strictness.LENIENT
.
This was the behavior of Mockito JUnit runner in versions 1.x.
Using this implementation of the runner is not recommended.
Engineers should care for removing unused stubbings because they are dead code,
they add unnecessary details, potentially making the test code harder to comprehend.
If you have good reasons to use the silent runner, let us know at the mailing list
or raise an issue in our issue tracker.
The purpose of silent implementation is to satisfy edge/unanticipated use cases,
and to offer users an opt-out.
Mockito framework is opinionated to drive clean tests but it is not dogmatic.
See also UnnecessaryStubbingException
.
Usage:
@RunWith(MockitoJUnitRunner.Silent.class)
public class ExampleTest {
// ...
}
- Since:
- 2.1.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mockito.junit.MockitoJUnitRunner
MockitoJUnitRunner.Silent, MockitoJUnitRunner.Strict, MockitoJUnitRunner.StrictStubs
-
Constructor Summary
-
Method Summary
Methods inherited from class org.mockito.junit.MockitoJUnitRunner
filter, getDescription, run
-
Constructor Details
-
Silent
- Throws:
InvocationTargetException
-