Class JacksonTester<T>

java.lang.Object
org.springframework.boot.test.json.AbstractJsonMarshalTester<T>
org.springframework.boot.test.json.JacksonTester<T>
Type Parameters:
T - the type under test

public class JacksonTester<T> extends AbstractJsonMarshalTester<T>
AssertJ based JSON tester backed by Jackson. Usually instantiated via initFields(Object, JsonMapper), for example:
public class ExampleObjectJsonTests {

    private JacksonTester<ExampleObject> json;

    @Before
    public void setup() {
        JsonMapper jsonMapper = new JsonMapper();
        JacksonTester.initFields(this, jsonMapper);
    }

    @Test
    public void testWriteJson() throws IOException {
        ExampleObject object = //...
        assertThat(json.write(object)).isEqualToJson("expected.json");
    }

}
See AbstractJsonMarshalTester for more details.
Since:
1.4.0
Author:
Phillip Webb, Madhura Bhave, Diego Berrueta