All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mockito.internal.debugging.WarningsCollector Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package org.mockito.internal.debugging;

import org.mockito.internal.invocation.InvocationMatcher;
import org.mockito.internal.invocation.UnusedStubsFinder;
import org.mockito.internal.invocation.finder.AllInvocationsFinder;
import org.mockito.invocation.Invocation;

import java.util.LinkedList;
import java.util.List;

@Deprecated
public class WarningsCollector {

    private final List createdMocks;

    public WarningsCollector() {
        createdMocks = new LinkedList();
    }

    public String getWarnings() {
        List unused = new UnusedStubsFinder().find(createdMocks);
        List all = AllInvocationsFinder.find(createdMocks);
        List allInvocationMatchers = InvocationMatcher.createFrom(all);

        return new WarningsPrinterImpl(unused, allInvocationMatchers, false).print();
    }
}