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

com.github.dreamhead.moco.matcher.NotRequestMatcher Maven / Gradle / Ivy

Go to download

Moco is an easy setup stub framework, mainly focusing on testing and integration.

There is a newer version: 1.5.0
Show newest version
package com.github.dreamhead.moco.matcher;

import com.github.dreamhead.moco.MocoConfig;
import com.github.dreamhead.moco.Request;
import com.github.dreamhead.moco.RequestMatcher;

public final class NotRequestMatcher extends AbstractRequestMatcher {
    private final RequestMatcher matcher;

    public NotRequestMatcher(final RequestMatcher matcher) {
        this.matcher = matcher;
    }

    @Override
    public boolean match(final Request request) {
        return !matcher.match(request);
    }

    @Override
    public RequestMatcher doApply(final MocoConfig config) {
        RequestMatcher appliedMatcher = matcher.apply(config);
        if (appliedMatcher == this.matcher) {
            return this;
        }

        return new NotRequestMatcher(appliedMatcher);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy