com.github.dreamhead.moco.matcher.EndsWithMatcher 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.Request;
import com.github.dreamhead.moco.RequestExtractor;
import com.github.dreamhead.moco.RequestMatcher;
import com.github.dreamhead.moco.resource.Resource;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
public class EndsWithMatcher extends AbstractOperatorMatcher {
public EndsWithMatcher(final RequestExtractor extractor, final Resource expected) {
super(extractor, expected, new Predicate() {
@Override
public boolean apply(final String input) {
return input.endsWith(expected.readFor(Optional.absent()).toString());
}
});
}
@Override
protected RequestMatcher newMatcher(final RequestExtractor extractor, final Resource resource) {
return new StartsWithMatcher<>(extractor, resource);
}
}