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

org.mockserver.verify.VerificationTimes Maven / Gradle / Ivy

There is a newer version: 5.15.0
Show newest version
package org.mockserver.verify;

import org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString;

/**
 * @author jamesdbloom
 */
public class VerificationTimes extends ObjectWithReflectiveEqualsHashCodeToString {

    private final int count;
    private final boolean exact;

    private VerificationTimes(int count, boolean exact) {
        this.count = count;
        this.exact = exact;
    }

    public static VerificationTimes once() {
        return new VerificationTimes(1, true);
    }

    public static VerificationTimes exactly(int count) {
        return new VerificationTimes(count, true);
    }

    public static VerificationTimes atLeast(int count) {
        return new VerificationTimes(count, false);
    }

    public int getCount() {
        return count;
    }

    public boolean isExact() {
        return exact;
    }

    public String toString() {
        String string = "";
        if (exact) {
            string += "exactly ";
        } else {
            string += "at least ";
        }
        if (count == 1) {
            string += "once";
        } else {
            string += count + " times";
        }
        return string;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy