Package com.github.dreamhead.moco

Source Code of com.github.dreamhead.moco.MocoRequestHit

package com.github.dreamhead.moco;

import com.github.dreamhead.moco.monitor.DefaultRequestHit;
import com.github.dreamhead.moco.verification.AtLeastVerification;
import com.github.dreamhead.moco.verification.AtMostVerification;
import com.github.dreamhead.moco.verification.BetweenVerification;
import com.github.dreamhead.moco.verification.TimesVerification;

import static com.google.common.base.Preconditions.checkArgument;

public class MocoRequestHit {
    public static RequestHit requestHit() {
        return new DefaultRequestHit();
    }

    public static UnexpectedRequestMatcher unexpected() {
        return new UnexpectedRequestMatcher();
    }

    public static VerificationMode never() {
        return times(0);
    }

    public static VerificationMode once() {
        return times(1);
    }

    public static VerificationMode times(final int count) {
        checkArgument(count >= 0, "Times count must not be less than zero");
        return new TimesVerification(count);
    }

    public static VerificationMode atLeast(final int count) {
        checkArgument(count > 0, "Times count must be greater than zero");
        return new AtLeastVerification(count);
    }

    public static VerificationMode atMost(final int count) {
        checkArgument(count > 0, "Times count must be greater than zero");
        return new AtMostVerification(count);
    }

    public static VerificationMode between(final int min, final int max) {
        return new BetweenVerification(min, max);
    }

    private MocoRequestHit() {}
}
TOP

Related Classes of com.github.dreamhead.moco.MocoRequestHit

TOP
Copyright © 2018 www.massapi.com. 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.