use of org.springframework.test.web.servlet.ResultMatcher in project spring-framework by spring-projects.
the class XpathResultMatchers method doesNotExist.
/**
* Evaluate the XPath and assert that content doesn't exist.
*/
public ResultMatcher doesNotExist() {
return new ResultMatcher() {
@Override
public void match(MvcResult result) throws Exception {
MockHttpServletResponse response = result.getResponse();
xpathHelper.doesNotExist(response.getContentAsByteArray(), getDefinedEncoding(response));
}
};
}
use of org.springframework.test.web.servlet.ResultMatcher in project spring-framework by spring-projects.
the class XpathResultMatchers method booleanValue.
/**
* Evaluate the XPath and assert the {@link Boolean} value found.
*/
public ResultMatcher booleanValue(final Boolean value) {
return new ResultMatcher() {
@Override
public void match(MvcResult result) throws Exception {
MockHttpServletResponse response = result.getResponse();
xpathHelper.assertBoolean(response.getContentAsByteArray(), getDefinedEncoding(response), value);
}
};
}
use of org.springframework.test.web.servlet.ResultMatcher in project spring-framework by spring-projects.
the class XpathResultMatchers method exists.
/**
* Evaluate the XPath and assert that content exists.
*/
public ResultMatcher exists() {
return new ResultMatcher() {
@Override
public void match(MvcResult result) throws Exception {
MockHttpServletResponse response = result.getResponse();
xpathHelper.exists(response.getContentAsByteArray(), getDefinedEncoding(response));
}
};
}
use of org.springframework.test.web.servlet.ResultMatcher in project spring-framework by spring-projects.
the class XpathResultMatchers method number.
/**
* Evaluate the XPath and assert the {@link Double} value found.
*/
public ResultMatcher number(final Double expectedValue) {
return new ResultMatcher() {
@Override
public void match(MvcResult result) throws Exception {
MockHttpServletResponse response = result.getResponse();
xpathHelper.assertNumber(response.getContentAsByteArray(), getDefinedEncoding(response), expectedValue);
}
};
}
use of org.springframework.test.web.servlet.ResultMatcher in project spring-framework by spring-projects.
the class XpathResultMatchers method nodeCount.
/**
* Evaluate the XPath and assert the number of nodes found with the given
* Hamcrest {@link Matcher}.
*/
public ResultMatcher nodeCount(final Matcher<Integer> matcher) {
return new ResultMatcher() {
@Override
public void match(MvcResult result) throws Exception {
MockHttpServletResponse response = result.getResponse();
xpathHelper.assertNodeCount(response.getContentAsByteArray(), getDefinedEncoding(response), matcher);
}
};
}
Aggregations