public class Jackson2TestUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Jackson2TestUtil.JsonObjectAssert<S extends Jackson2TestUtil.JsonObjectAssert<S,A>,A> |
static class |
Jackson2TestUtil.JsonStringAssert |
| Constructor and Description |
|---|
Jackson2TestUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
assertJsonEquals(String text,
String expected,
Class<T> typeReference) |
static <S extends Jackson2TestUtil.JsonObjectAssert<S,T>,T> |
assertThatJson(Class<T> o,
String value) |
static Jackson2TestUtil.JsonStringAssert |
assertThatJson(String o) |
static <S extends Jackson2TestUtil.JsonObjectAssert<S,T>,T> |
assertThatJson(T o) |
static <T> T |
roundTrip(T input) |
static <T> T |
roundTrip(T input,
String contains)
Marshalls input, checks whether it contains a string, and unmarshall it.
|
static <T> T |
roundTripAndSimilar(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
String expected) |
protected static <T> T |
roundTripAndSimilar(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
String expected,
com.fasterxml.jackson.databind.JavaType typeReference) |
static <T> T |
roundTripAndSimilar(T input,
String expected)
Marshalls input, checks whether it is similar to expected string, and unmarshall it.
|
protected static <T> T |
roundTripAndSimilar(T input,
String expected,
com.fasterxml.jackson.databind.JavaType typeReference) |
static <T> T |
roundTripAndSimilarAndEquals(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
String expected) |
static <T> T |
roundTripAndSimilarAndEquals(T input,
String expected)
Marshalls input, checks whether it is similar to expected string, and unmarshall it.
|
static <T> T |
roundTripAndSimilarValue(T input,
String expected)
Can be used if the input is not a stand alone json object.
|
public static <T> T roundTrip(T input,
String contains)
throws Exception
Marshalls input, checks whether it contains a string, and unmarshall it.
Checks whether marshalling and unmarshalling happens without errors, and the return value can be checked with other tests.
Exceptionpublic static <T> T roundTripAndSimilar(T input,
String expected)
throws Exception
Marshalls input, checks whether it is similar to expected string, and unmarshall it.
Checks whether marshalling and unmarshalling happens without errors, and the return value can be checked with other tests.
Exceptionpublic static <T> T roundTripAndSimilar(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
String expected)
throws Exception
Exceptionpublic static <T> T roundTripAndSimilarAndEquals(T input,
String expected)
throws Exception
Checks whether marshalling and unmarshalling happens without errors, and the return value can be checked with other tests.
Exceptionpublic static <T> T roundTripAndSimilarAndEquals(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
String expected)
throws Exception
Exceptionpublic static <T> T assertJsonEquals(String text, String expected, Class<T> typeReference) throws IOException
IOExceptionprotected static <T> T roundTripAndSimilar(T input,
String expected,
com.fasterxml.jackson.databind.JavaType typeReference)
throws Exception
Exceptionprotected static <T> T roundTripAndSimilar(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
String expected,
com.fasterxml.jackson.databind.JavaType typeReference)
throws Exception
Exceptionpublic static <T> T roundTripAndSimilarValue(T input,
String expected)
throws Exception
Exceptionpublic static <S extends Jackson2TestUtil.JsonObjectAssert<S,T>,T> Jackson2TestUtil.JsonObjectAssert<S,T> assertThatJson(T o)
public static <S extends Jackson2TestUtil.JsonObjectAssert<S,T>,T> Jackson2TestUtil.JsonObjectAssert<S,T> assertThatJson(Class<T> o, String value)
public static Jackson2TestUtil.JsonStringAssert assertThatJson(String o)
Copyright © 2019. All rights reserved.