I was making a rest-assured test for testing url redirects using testng. I would like to match header location response to match with regular expression.
I am trying to create following method but I didn't find any regular expression matcher using Hamcrest matcher. I would like to use some method like matches (or if any other option) as used in the method.
public Response matchRedirect(String url, Integer statusCode, String urlRegex) {
return
given().
redirects().follow(false).and().redirects().max(0).
expect().
statusCode(statusCode).
header("Location", **matches**(urlRegex)).
when().get(url);
}