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

com.fitbur.mockito.internal.verification.VerificationModeFactory 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.verification;

import com.fitbur.mockito.verification.VerificationMode;

public class VerificationModeFactory {
    
    public static VerificationMode atLeastOnce() {
        return atLeast(1);
    }

    public static VerificationMode atLeast(int minNumberOfInvocations) {
        return new AtLeast(minNumberOfInvocations);
    }

    public static VerificationMode only() {
        return new Only(); //TODO make exception message nicer
    }

    public static Times times(int wantedNumberOfInvocations) {
        return new Times(wantedNumberOfInvocations);
    }

    public static Calls calls(int wantedNumberOfInvocations) {
        return new Calls( wantedNumberOfInvocations );
    }

    public static NoMoreInteractions noMoreInteractions() {
        return new NoMoreInteractions();
    }

    public static VerificationMode atMost(int maxNumberOfInvocations) {
        return new AtMost(maxNumberOfInvocations);
    }
    
    /**
     * Verification mode will prepend the specified failure message if verification fails with the given implementation.
     * @param mode Implementation used for verification
     * @param description The custom failure message
     * @return VerificationMode
     * @since 2.0.0
     */
    public static VerificationMode description(VerificationMode mode, String description) {
        return new Description(mode, description);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy