@Override public void bodyDoesNotContain(String body) { this.facade.response().then().body(not(containsString(body))); }
@Override public void statusCodeIsNot(int statusCode) { this.facade.response().then().statusCode(not(statusCode)); }
@Override public void bodyContains(String body) { this.facade.response().then().body(containsString(body)); }
@Override public void headerContains(String headerName, String text) { this.facade.response().then().header(headerName, containsString(text)); }
@Override public void bodyContainsJsonPathValueContainingPhrase(String path, String phrase) { Response response = this.facade.response(); assertThat(response, JsonMatchers.containsValueByPath(ResponseContentProvider.INSTANCE, getPath(path), containsString(phrase))); }
@Override public void varAssignedFromHeader(@InflateContext.Ignore String varName, String headerName) { String value = this.facade.response().getHeader(headerName); this.world.put(varName, value); }
@Override public void bodyDoesNotContainPath(String path) { Object value = this.facade.response().body().path(getPath(path)); assertThat(value, nullValue()); }
@Override public void bodyContainsPathNotMatchingPattern(String path, String pattern) { Response response = this.facade.response(); assertThat(response, JsonMatchers.containsValueByPath(ResponseContentProvider.INSTANCE, getPath(path), MiscMatchers.that(Matchers.not(ContainsPattern.containsPattern(pattern))))); }
@Override public void varAssignedFromProperty(@InflateContext.Ignore String varName, String property) { String value = String.valueOf(this.facade.response().body().<Object>path(getPath(property))); this.world.put(varName, value); }
@Override public void bodyContainsArrayWithSize(String path, String size) { Response response = this.facade.response(); assertThat(response, JsonMatchers.containsValueByPath(ResponseContentProvider.INSTANCE, getPath(path), ArrayWithSizeMatcher.arrayWithSize(size))); }
@Override public void bodyContainsArrayWithSize(String path, String size) { Response response = this.facade.response(); assertThat(response, JsonMatchers.containsValueByPath(ResponseContentProvider.INSTANCE, getPath(path), ArrayWithSizeMatcher.arrayWithSize(size))); }
@Override public void bodyContainsPathOfType(String path, String type) { Response response = this.facade.response(); assertThat(response, JsonMatchers.containsValueByPath(ResponseContentProvider.INSTANCE, getPath(path), OfTypeMatcher.ofType(type))); }
@Override public void bodyContainsPathOfType(String path, String type) { Response response = this.facade.response(); assertThat(response, JsonMatchers.containsValueByPath(ResponseContentProvider.INSTANCE, getPath(path), OfTypeMatcher.ofType(type))); }
@Override public void bodyContainsPathWithOtherValue(String path, String value) { Response response = this.facade.response(); assertThat(response, JsonMatchers.containsValueByPath(ResponseContentProvider.INSTANCE, getPath(path), EqualToIgnoringTypeMatcher.notEqualToIgnoringType(value))); }
@Override public void varAssignedFromBody(@InflateContext.Ignore String varName) { String value = this.facade.response().body().asString(); this.world.put(varName, value); }
@Override public void bodyContainsPathWithOtherValue(String path, String value) { Response response = this.facade.response(); assertThat(response, JsonMatchers.containsValueByPath(ResponseContentProvider.INSTANCE, getPath(path), EqualToIgnoringTypeMatcher.notEqualToIgnoringType(value))); }
@Override public void statusCodeIs(final int statusCode) { final boolean appendBody = world.getBoolean(CukesOptions.ASSERTS_STATUS_CODE_DISPLAY_BODY, false); final Integer maxSize = world.get(CukesOptions.ASSERTS_STATUS_CODE_MAX_SIZE).transform(new Function<String, Integer>() { @Override public Integer apply(String s) { return Integer.parseInt(s); } }).orNull(); final Response response = facade.response(); response.then().statusCode(new StatusCodeMatcher(statusCode, response, appendBody, maxSize)); }
@Override public void bodyContainsPathMatchingPattern(String path, String pattern) { Response response = this.facade.response(); assertThat(response, JsonMatchers.containsValueByPath(ResponseContentProvider.INSTANCE, getPath(path), MiscMatchers.that(ContainsPattern.containsPattern(pattern)))); }
@Override public void bodyContainsArrayWithObjectHavingProperty(String path, String property, String value) { Response response = this.facade.response(); assertThat(response, containsPropertyValueByPathInArray(ResponseContentProvider.INSTANCE, getPath(path), property, equalToIgnoringType(value, this.world.getBoolean("case-insensitive"))) ); }
@Override public void bodyContainsPathWithValue(String path, String value) { Response response = this.facade.response(); assertThat(response, JsonMatchers.containsValueByPath(ResponseContentProvider.INSTANCE, getPath(path), EqualToIgnoringTypeMatcher.equalToIgnoringType(value, this.world.getBoolean("case-insensitive")))); }