com.github.dreamhead.moco.matcher.ExistMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of moco-core Show documentation
Show all versions of moco-core Show documentation
Moco is an easy setup stub framework, mainly focusing on testing and integration.
package com.github.dreamhead.moco.matcher;
import com.github.dreamhead.moco.MocoConfig;
import com.github.dreamhead.moco.Request;
import com.github.dreamhead.moco.RequestExtractor;
import com.github.dreamhead.moco.RequestMatcher;
import com.google.common.base.Optional;
public class ExistMatcher extends AbstractRequestMatcher {
private final RequestExtractor extractor;
public ExistMatcher(final RequestExtractor extractor) {
this.extractor = extractor;
}
@Override
public boolean match(final Request request) {
Optional extractContent = extractor.extract(request);
return extractContent.isPresent();
}
@Override
@SuppressWarnings("unchecked")
public RequestMatcher doApply(final MocoConfig config) {
return this;
}
}