public class UnusedStubbingsFinder
extends java.lang.Object
Constructor and Description |
---|
UnusedStubbingsFinder() |
Modifier and Type | Method and Description |
---|---|
UnusedStubbings |
getUnusedStubbings(java.lang.Iterable<java.lang.Object> mocks)
Gets all unused stubbings for given set of mock objects, in order.
|
java.util.Collection<Invocation> |
getUnusedStubbingsByLocation(java.lang.Iterable<java.lang.Object> mocks)
Gets unused stubbings per location.
|
public UnusedStubbings getUnusedStubbings(java.lang.Iterable<java.lang.Object> mocks)
public java.util.Collection<Invocation> getUnusedStubbingsByLocation(java.lang.Iterable<java.lang.Object> mocks)
getUnusedStubbings(Iterable)
.
It considers that stubbings with the same location (e.g. ClassFile + line number) are the same.
This is not completely accurate because a stubbing declared in a setup or constructor
is created per each test method. Because those are different test methods,
different mocks are created, different 'Invocation' instance is backing the 'Stubbing' instance.
In certain scenarios (detecting unused stubbings by JUnit runner), we need this exact level of accuracy.
Stubbing declared in constructor but realized in % of test methods is considered as 'used' stubbing.
There are high level unit tests that demonstrate this scenario.