AbstractJsonMarshalTester
Base class for AssertJ based JSON marshal testers. Exposes specific Asserts following a read
, write
or parse
of JSON content. Typically used in combination with an AssertJ assertThat call. For example:
public class ExampleObjectJsonTests {
private AbstractJsonTester<ExampleObject> json = //...
@Test
public void testWriteJson() {
ExampleObject object = //...
assertThat(json.write(object)).isEqualToJson("expected.json");
assertThat(json.read("expected.json")).isEqualTo(object);
}
}
Content copied to clipboard
To use this library JSONAssert must be on the test classpath.
Author
Phillip Webb
Since
1.4.0
Parameters
<T>
the type under test
See also
Inheritors
Constructors
Link copied to clipboard
Create a new AbstractJsonMarshalTester instance.
Functions
Link copied to clipboard
Return ObjectContent from parsing the specific JSON bytes.
Return ObjectContent from parsing the specific JSON String.
Link copied to clipboard
Return the object created from parsing the specific JSON bytes.
Return the object created from parsing the specific JSON String.
Link copied to clipboard
Return ObjectContent from reading from the specified file.
Return ObjectContent from reading from the specified input stream.
Return ObjectContent from reading from the specified reader.
Return ObjectContent from reading from the specified classpath resource.
Return ObjectContent from reading from the specified resource.
Link copied to clipboard
Return the object created from reading from the specified file.
Return the object created from reading from the specified input stream.
Return the object created from reading from the specified reader.
Return the object created from reading from the specified classpath resource.
Return the object created from reading from the specified resource.
Link copied to clipboard
Return JsonContent from writing the specific value.