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

lv.ctco.cukesrest.internal.matchers.EndsWithRegexp Maven / Gradle / Ivy

The newest version!
package lv.ctco.cukesrest.internal.matchers;

import org.hamcrest.*;
import org.hamcrest.Matcher;

import java.util.regex.*;

public class EndsWithRegexp {

    public static Matcher endsWithRegexp(final String regexp) {
        return new BaseMatcher() {

            @Override
            public void describeTo(Description description) {
                description.appendText("matches pattern " + regexp);
            }

            @Override
            public boolean matches(Object item) {
                String value = (String) item;
                java.util.regex.Matcher matcher = Pattern.compile(".*" + regexp).matcher(value);

                return matcher.matches();
            }
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy