Package org.mockito.internal.matchers

Examples of org.mockito.internal.matchers.MatchersPrinter


    public String toString() {
        return toString(argumentsToMatchers(), new PrintSettings());
    }

    protected String toString(List<Matcher> matchers, PrintSettings printSettings) {
        MatchersPrinter matchersPrinter = new MatchersPrinter();
        String method = qualifiedMethodName();
        String invocation = method + matchersPrinter.getArgumentsLine(matchers, printSettings);
        if (printSettings.isMultiline() || (!matchers.isEmpty() && invocation.length() > MAX_LINE_LENGTH)) {
            return method + matchersPrinter.getArgumentsBlock(matchers, printSettings);
        } else {
            return invocation;
        }
    }
View Full Code Here


    public String toString() {
        return toString(argumentsToMatchers(), new PrintSettings());
    }

    protected String toString(List<Matcher> matchers, PrintSettings printSettings) {
        MatchersPrinter matchersPrinter = new MatchersPrinter();
        String method = qualifiedMethodName();
        String invocation = method + matchersPrinter.getArgumentsLine(matchers, printSettings);
        if (printSettings.isMultiline() || (!matchers.isEmpty() && invocation.length() > MAX_LINE_LENGTH)) {
            return method + matchersPrinter.getArgumentsBlock(matchers, printSettings);
        } else {
            return invocation;
        }
    }
View Full Code Here

    public void setMatchersToBeDescribedWithExtraTypeInfo(Integer[] indexesOfMatchers) {
        this.withTypeInfo = Arrays.asList(indexesOfMatchers);
    }

    public String print(List<Matcher> matchers, Invocation invocation) {
        MatchersPrinter matchersPrinter = new MatchersPrinter();
        String qualifiedName = new MockUtil().getMockName(invocation.getMock()) + "." + invocation.getMethod().getName();
        String invocationString = qualifiedName + matchersPrinter.getArgumentsLine(matchers, this);
        if (isMultiline() || (!matchers.isEmpty() && invocationString.length() > MAX_LINE_LENGTH)) {
            return qualifiedName + matchersPrinter.getArgumentsBlock(matchers, this);
        } else {
            return invocationString;
        }
    }
View Full Code Here

    public String toString() {
        return toString(argumentsToMatchers(), new PrintSettings());
    }

    protected String toString(List<Matcher> matchers, PrintSettings printSettings) {
        MatchersPrinter matchersPrinter = new MatchersPrinter();
        String method = qualifiedMethodName();
        String invocation = method + matchersPrinter.getArgumentsLine(matchers, printSettings);
        if (printSettings.isMultiline() || (!matchers.isEmpty() && invocation.length() > MAX_LINE_LENGTH)) {
            return method + matchersPrinter.getArgumentsBlock(matchers, printSettings);
        } else {
            return invocation;
        }
    }
View Full Code Here

             * "isMockitoMock" returns false is that the mock is not created by
             * the Mockito CGLib Enhancer in case of static methods.
             */
            @Override
            protected String toString(@SuppressWarnings("rawtypes") List<Matcher> matchers, PrintSettings printSettings) {
                MatchersPrinter matchersPrinter = new MatchersPrinter();
                String method = Whitebox.getType(getMock()).getName() + "." + getMethodName();
                String invocation = method + matchersPrinter.getArgumentsLine(matchers, printSettings);
                if (printSettings.isMultiline()
                        || (!matchers.isEmpty() && invocation.length() > Whitebox.<Integer> getInternalState(
                        Invocation.class, "MAX_LINE_LENGTH"))) {
                    return method + matchersPrinter.getArgumentsBlock(matchers, printSettings);
                } else {
                    return invocation;
                }
            }
        };
View Full Code Here

    public String toString() {
        return toString(argumentsToMatchers(), new PrintSettings());
    }

    protected String toString(List<Matcher> matchers, PrintSettings printSettings) {
        MatchersPrinter matchersPrinter = new MatchersPrinter();
        String method = qualifiedMethodName();
        String invocation = method + matchersPrinter.getArgumentsLine(matchers, printSettings);
        if (printSettings.isMultiline() || (!matchers.isEmpty() && invocation.length() > MAX_LINE_LENGTH)) {
            return method + matchersPrinter.getArgumentsBlock(matchers, printSettings);
        } else {
            return invocation;
        }
    }
View Full Code Here

    public String toString() {
        return toString(argumentsToMatchers(), new PrintSettings());
    }

    protected String toString(List<Matcher> matchers, PrintSettings printSettings) {
        MatchersPrinter matchersPrinter = new MatchersPrinter();
        String method = qualifiedMethodName();
        String invocation = method + matchersPrinter.getArgumentsLine(matchers, printSettings);
        if (printSettings.isMultiline() || (!matchers.isEmpty() && invocation.length() > MAX_LINE_LENGTH)) {
            return method + matchersPrinter.getArgumentsBlock(matchers, printSettings);
        } else {
            return invocation;
        }
    }
View Full Code Here

public class ToStringGenerator {

    public String generate(Object mock, Method method, Object[] arguments) {
        final List<Matcher> matcherList = ArgumentsProcessor.argumentsToMatchers(arguments);
        final PrintSettings printSettings = new PrintSettings();
        MatchersPrinter matchersPrinter = new MatchersPrinter();

        String methodName = Whitebox.getType(mock).getName() + "." + method.getName();
        String invocation = methodName + matchersPrinter.getArgumentsLine(matcherList, printSettings);
        if (printSettings.isMultiline()
                || (!matcherList.isEmpty() && invocation.length() > Whitebox.<Integer> getInternalState(
                PrintSettings.class, "MAX_LINE_LENGTH"))) {
            return methodName + matchersPrinter.getArgumentsBlock(matcherList, printSettings);
        } else {
            return invocation;
        }
    }
View Full Code Here

             * "isMockitoMock" returns false is that the mock is not created by
             * the Mockito CGLib Enhancer in case of static methods.
             */
            @Override
            protected String toString(@SuppressWarnings("rawtypes") List<Matcher> matchers, PrintSettings printSettings) {
                MatchersPrinter matchersPrinter = new MatchersPrinter();
                String method = Whitebox.getType(getMock()).getName() + "." + getMethodName();
                String invocation = method + matchersPrinter.getArgumentsLine(matchers, printSettings);
                if (printSettings.isMultiline()
                        || (!matchers.isEmpty() && invocation.length() > Whitebox.<Integer> getInternalState(
                        Invocation.class, "MAX_LINE_LENGTH"))) {
                    return method + matchersPrinter.getArgumentsBlock(matchers, printSettings);
                } else {
                    return invocation;
                }
            }
        };
View Full Code Here

TOP

Related Classes of org.mockito.internal.matchers.MatchersPrinter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.