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

com.fitbur.mockito.internal.exceptions.util.ScenarioPrinter Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package com.fitbur.mockito.internal.exceptions.util;

import java.util.List;

import com.fitbur.mockito.internal.exceptions.VerificationAwareInvocation;

public class ScenarioPrinter {

    public String print(List invocations) {
        if (invocations.size() == 1) {
            return "Actually, above is the only interaction with this mock.";
        }
        StringBuilder sb = new StringBuilder(
                "***\n" +
                "For your reference, here is the list of all invocations ([?] - means unverified).\n");
        
        int counter = 0;
        for (VerificationAwareInvocation i : invocations) {
            sb.append(++counter).append(". ");
            if (!i.isVerified()) {
                sb.append("[?]");
            }
            sb.append(i.getLocation()).append("\n");
        }
        return sb.toString();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy