Search in sources :

Example 1 with StubbingComparator

use of org.mockito.internal.stubbing.StubbingComparator in project mockito by mockito.

the class AllInvocationsFinder method findStubbings.

/**
     * Gets all stubbings from mocks. Invocations are ordered earlier first.
     *
     * @param mocks mocks
     * @return stubbings
     */
public static Set<Stubbing> findStubbings(Iterable<?> mocks) {
    Set<Stubbing> stubbings = new TreeSet<Stubbing>(new StubbingComparator());
    for (Object mock : mocks) {
        Collection<? extends Stubbing> fromSingleMock = new DefaultMockingDetails(mock).getStubbings();
        stubbings.addAll(fromSingleMock);
    }
    return stubbings;
}
Also used : StubbingComparator(org.mockito.internal.stubbing.StubbingComparator) Stubbing(org.mockito.stubbing.Stubbing) DefaultMockingDetails(org.mockito.internal.util.DefaultMockingDetails)

Example 2 with StubbingComparator

use of org.mockito.internal.stubbing.StubbingComparator in project mockito by mockito.

the class DefaultMockingDetails method getStubbings.

@Override
public Collection<Stubbing> getStubbings() {
    List<? extends Stubbing> stubbings = mockHandler().getInvocationContainer().getStubbedInvocations();
    TreeSet<Stubbing> out = new TreeSet<Stubbing>(new StubbingComparator());
    out.addAll(stubbings);
    return out;
}
Also used : StubbingComparator(org.mockito.internal.stubbing.StubbingComparator) Stubbing(org.mockito.stubbing.Stubbing) TreeSet(java.util.TreeSet)

Aggregations

StubbingComparator (org.mockito.internal.stubbing.StubbingComparator)2 Stubbing (org.mockito.stubbing.Stubbing)2 TreeSet (java.util.TreeSet)1 DefaultMockingDetails (org.mockito.internal.util.DefaultMockingDetails)1