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 void |
assertJsonEquals(CharSequence expected,
CharSequence actual) |
static void |
assertJsonEquals(String pref,
CharSequence expected,
CharSequence actual) |
static <T> T |
assertJsonEquals(String actual,
String expected,
Class<T> typeReference) |
static <S extends Jackson2TestUtil.JsonObjectAssert<S,T>,T> |
assertThatJson(Class<T> o,
String value) |
static <S extends Jackson2TestUtil.JsonObjectAssert<S,T>,T> |
assertThatJson(com.fasterxml.jackson.databind.ObjectMapper mapper,
Class<T> o,
String value) |
static <S extends Jackson2TestUtil.JsonObjectAssert<S,T>,T> |
assertThatJson(com.fasterxml.jackson.databind.ObjectMapper mapper,
T o) |
static Jackson2TestUtil.JsonStringAssert |
assertThatJson(String o) |
static <S extends Jackson2TestUtil.JsonObjectAssert<S,T>,T> |
assertThatJson(T o) |
static CharSequence |
prettify(CharSequence test) |
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,
InputStream expected) |
static <T> T |
roundTripAndSimilar(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
com.fasterxml.jackson.databind.JsonNode expected) |
protected static <T> T |
roundTripAndSimilar(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
com.fasterxml.jackson.databind.JsonNode expected,
com.fasterxml.jackson.databind.JavaType typeReference) |
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,
com.fasterxml.jackson.databind.JsonNode expected) |
static <T> T |
roundTripAndSimilar(T input,
String expected)
Marshalls input, checks whether it is similar to expected string, and unmarshals it, then marshall it again, and it should still be similar.
|
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,
com.fasterxml.jackson.databind.JsonNode 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 void assertJsonEquals(String pref, CharSequence expected, CharSequence actual)
public static CharSequence prettify(CharSequence test)
public static void assertJsonEquals(CharSequence expected, CharSequence actual)
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 unmarshals it, then marshall it again, and it should still be similar.
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,
com.fasterxml.jackson.databind.JsonNode expected)
throws Exception
Exceptionpublic static <T> T roundTripAndSimilar(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
String expected)
throws Exception
Exceptionpublic static <T> T roundTripAndSimilar(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
com.fasterxml.jackson.databind.JsonNode expected)
throws Exception
Exceptionpublic static <T> T roundTripAndSimilar(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
InputStream 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(T input,
com.fasterxml.jackson.databind.JsonNode expected)
throws Exception
Exceptionpublic static <T> T roundTripAndSimilarAndEquals(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
String expected)
throws Exception
Exceptionpublic static <T> T assertJsonEquals(String actual, 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
Exceptionprotected static <T> T roundTripAndSimilar(com.fasterxml.jackson.databind.ObjectMapper mapper,
T input,
com.fasterxml.jackson.databind.JsonNode 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(com.fasterxml.jackson.databind.ObjectMapper mapper, T o)
public static <S extends Jackson2TestUtil.JsonObjectAssert<S,T>,T> Jackson2TestUtil.JsonObjectAssert<S,T> assertThatJson(Class<T> o, String value)
public static <S extends Jackson2TestUtil.JsonObjectAssert<S,T>,T> Jackson2TestUtil.JsonObjectAssert<S,T> assertThatJson(com.fasterxml.jackson.databind.ObjectMapper mapper, Class<T> o, String value)
public static Jackson2TestUtil.JsonStringAssert assertThatJson(String o)
Copyright © 2019. All rights reserved.