AssertJ for JSON

A set of AssertJ assertions for JSON validation.

Лицензия

Лицензия

Категории

Категории

JSON Данные
Группа

Группа

com.revinate
Идентификатор

Идентификатор

assertj-json
Последняя версия

Последняя версия

1.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

AssertJ for JSON
A set of AssertJ assertions for JSON validation.
Ссылка на сайт

Ссылка на сайт

https://github.com/revinate/assertj-json
Система контроля версий

Система контроля версий

https://github.com/revinate/assertj-json

Скачать assertj-json

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.revinate/assertj-json/ -->
<dependency>
    <groupId>com.revinate</groupId>
    <artifactId>assertj-json</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.revinate/assertj-json/
implementation 'com.revinate:assertj-json:1.2.0'
// https://jarcasting.com/artifacts/com.revinate/assertj-json/
implementation ("com.revinate:assertj-json:1.2.0")
'com.revinate:assertj-json:jar:1.2.0'
<dependency org="com.revinate" name="assertj-json" rev="1.2.0">
  <artifact name="assertj-json" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.revinate', module='assertj-json', version='1.2.0')
)
libraryDependencies += "com.revinate" % "assertj-json" % "1.2.0"
[com.revinate/assertj-json "1.2.0"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
com.fasterxml.jackson.core : jackson-core jar 2.6.3
com.jayway.jsonpath : json-path jar 2.4.0
com.fasterxml.jackson.core : jackson-databind jar 2.6.3
org.assertj : assertj-core jar 3.8.0

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

AssertJ Json

Build Status Maven Central Javadoc codecov.io Codacy Badge

A set of AssertJ assertions to validate JSON.

JsonPath

Use JsonPathAssert to extract values using JsonPath and validate as a Java string, integer or list.

Example:

DocumentContext ctx = JsonPath.parse("{\"value\":\"a text value\"}");

assertThat(ctx).jsonPathAsString("$.value").contains("text").endsWith("value");

Runtime configuration

JsonPathAssert uses JayWay JsonPath under the covers. In order to execute more complex extractions like array of strings to List<String> you need to have Jackson or Gson in your classpath and configure JsonPath to use one of them.

One option is to execute the following snipped of code in a @BeforeClass method in your test class.

Configuration.setDefaults(new Configuration.Defaults() {
    private final JsonProvider jsonProvider = new JacksonJsonProvider();
    private final MappingProvider mappingProvider = new JacksonMappingProvider();

    @Override
    public JsonProvider jsonProvider() {
        return jsonProvider;
    }

    @Override
    public MappingProvider mappingProvider() {
        return mappingProvider;
    }

    @Override
    public Set<Option> options() {
        return EnumSet.noneOf(Option.class);
    }
});
com.revinate

Revinate, Inc.

Версии библиотеки

Версия
1.2.0
1.1.0
1.0.1
1.0.0