use of org.springframework.test.web.servlet.ResultMatcher in project spring-framework by spring-projects.
the class CookieResultMatchers method version.
/**
* Assert a cookie's version value.
*/
public ResultMatcher version(final String name, final int version) {
return new ResultMatcher() {
@Override
public void match(MvcResult result) throws Exception {
Cookie cookie = result.getResponse().getCookie(name);
assertEquals("Response cookie version", version, cookie.getVersion());
}
};
}
use of org.springframework.test.web.servlet.ResultMatcher in project spring-framework by spring-projects.
the class CookieResultMatchers method path.
public ResultMatcher path(final String name, final String path) {
return new ResultMatcher() {
@Override
public void match(MvcResult result) throws Exception {
Cookie cookie = result.getResponse().getCookie(name);
assertEquals("Response cookie path", path, cookie.getPath());
}
};
}
use of org.springframework.test.web.servlet.ResultMatcher in project spring-framework by spring-projects.
the class CookieResultMatchers method path.
/**
* Assert a cookie path with a Hamcrest {@link Matcher}.
*/
public ResultMatcher path(final String name, final Matcher<? super String> matcher) {
return new ResultMatcher() {
@Override
public void match(MvcResult result) throws Exception {
Cookie cookie = result.getResponse().getCookie(name);
assertThat("Response cookie path", cookie.getPath(), matcher);
}
};
}
use of org.springframework.test.web.servlet.ResultMatcher in project spring-framework by spring-projects.
the class CookieResultMatchers method domain.
/**
* Assert a cookie's domain with a Hamcrest {@link Matcher}.
*/
public ResultMatcher domain(final String name, final Matcher<? super String> matcher) {
return new ResultMatcher() {
@Override
public void match(MvcResult result) throws Exception {
Cookie cookie = result.getResponse().getCookie(name);
assertThat("Response cookie domain", cookie.getDomain(), matcher);
}
};
}
use of org.springframework.test.web.servlet.ResultMatcher in project spring-framework by spring-projects.
the class CookieResultMatchers method comment.
/**
* Assert a cookie's comment with a Hamcrest {@link Matcher}.
*/
public ResultMatcher comment(final String name, final Matcher<? super String> matcher) {
return new ResultMatcher() {
@Override
public void match(MvcResult result) throws Exception {
Cookie cookie = result.getResponse().getCookie(name);
assertThat("Response cookie comment", cookie.getComment(), matcher);
}
};
}
Aggregations