@Override public boolean matchesSafely(Response actualResponse) { String actualContent = actualResponse.getContent(); return bodyMatcher.matches(actualContent); }
@Override protected void describeMismatchSafely(Response response, Description mismatchDescription) { List<Header> headers = response.getHeaders(); if (headers.isEmpty()) { mismatchDescription.appendText("Response has no headers"); } else { mismatchDescription.appendText("Response has headers [" + StringUtils.join(response.getHeaders(), ", ") + "]"); } }
@Override protected void describeMismatchSafely(Response item, Description mismatchDescription) { mismatchDescription.appendText("Response has status code: " + item.getStatusCode()); }
@Override protected void describeMismatchSafely(Response response, Description mismatchDescription) { List<Header> headers = response.getHeaders(); if (headers.isEmpty()) { mismatchDescription.appendText("Response has no headers"); } else { mismatchDescription.appendText("Response has headers [" + StringUtils.join(response.getHeaders(), ", ") + "]"); } } }
@Override public boolean matchesSafely(Response actualResponse) { String actualContent = actualResponse.getContent(); return bodyMatcher.matches(actualContent); }
@Override protected boolean matchesSafely(Response item) { return statusCodeMatcher.matches(item.getStatusCode()); }
@Override protected void describeMismatchSafely(Response response, Description mismatchDescription) { List<Header> headers = response.getHeaders(); if (headers.isEmpty()) { mismatchDescription.appendText("Response has no headers"); } else { mismatchDescription.appendText("Response has headers [" + StringUtils.join(response.getHeaders(), ", ") + "]"); } } }
/** * Converts the content of the response to a JSON node. * * @param response The response whose content is to be converted * @return The converted JSON node */ public static JsonNode asJson(Response response) { return asJson(response.getContent()); }
@Override protected void describeMismatchSafely(Response item, Description mismatchDescription) { mismatchDescription.appendText("Response has status code: " + item.getStatusCode()); }
@Override protected void describeMismatchSafely(Response response, Description mismatchDescription) { List<Header> headers = response.getHeaders(); if (headers.isEmpty()) { mismatchDescription.appendText("Response has no headers"); } else { mismatchDescription.appendText("Response has headers [" + StringUtils.join(response.getHeaders(), ", ") + "]"); } }
/** * Converts the body of the given Response to an XML element. * * @param response The response to be converted * @return The converted element */ public static Element asXml(Response response) { return XmlUtil.asXml(response.getContent()); }
@Override protected boolean matchesSafely(Response item) { return statusCodeMatcher.matches(item.getStatusCode()); }
@Override protected boolean matchesSafely(Response response) { for (Header header : response.getHeaders()) { if (StringUtils.equalsIgnoreCase(header.getName(), name)) { return true; } } return false; }
/** * Converts the content of the response to a JSON node. * * @param response The response whose content is to be converted * @return The converted JSON node */ public static JsonNode asJson(Response response) { return asJson(response.getContent()); }
@Override protected boolean matchesSafely(Response response) { for (Header header : response.getHeaders()) { if (StringUtils.equalsIgnoreCase(header.getName(), name)) { return true; } } return false; }
/** * Converts the body of the given Response to an XML element. * * @param response The response to be converted * @return The converted element */ public static Element asXml(Response response) { return XmlUtil.asXml(response.getContent()); }
@Override protected boolean matchesSafely(Response response) { for (Header header : response.getHeaders()) { if (!StringUtils.equalsIgnoreCase(header.getName(), name)) { continue; } return valueMatcher.matches(header.getValue()); } return false; }
@Override protected boolean matchesSafely(Response response) { for (Header header : response.getHeaders()) { if (!StringUtils.equalsIgnoreCase(header.getName(), name)) { continue; } return valueMatcher.matches(header.getValue()); } return false; }