public static class MockitoJUnitRunner.Silent extends MockitoJUnitRunner
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 {
// ...
}
MockitoJUnitRunner.Silent, MockitoJUnitRunner.Strict, MockitoJUnitRunner.StrictStubs
filter, getDescription, run
public Silent(Class<?> klass) throws InvocationTargetException
InvocationTargetException