
com.revinate.assertj.json.JsonPathAssert Maven / Gradle / Ivy
package com.revinate.assertj.json;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.TypeRef;
import org.assertj.core.api.*;
import java.util.List;
public class JsonPathAssert extends AbstractAssert {
public JsonPathAssert(DocumentContext actual) {
super(actual, JsonPathAssert.class);
}
public static JsonPathAssert assertThat(DocumentContext documentContext) {
return new JsonPathAssert(documentContext);
}
public AbstractCharSequenceAssert, String> jsonPathAsString(String path) {
return Assertions.assertThat(actual.read(path, String.class));
}
public AbstractIntegerAssert> jsonPathAsInteger(String path) {
return Assertions.assertThat(actual.read(path, Integer.class));
}
public AbstractListAssert, ? extends List extends T>, T> jsonPathAsListOf(String path, Class type) {
return Assertions.assertThat(actual.read(path, new TypeRef>() {
}));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy