public class BasicJsonTester extends Object
public class ExampleObjectJsonTests { private BasicJsonTester json = new BasicJsonTester(getClass()); @Test public void testWriteJson() throws IOException { assertThat(json.from("example.json")).extractingJsonPathStringValue("@.name") .isEqualTo("Spring"); } }See
AbstractJsonMarshalTester
for more details.Constructor and Description |
---|
BasicJsonTester(Class<?> resourceLoadClass)
Create a new
BasicJsonTester instance. |
Modifier and Type | Method and Description |
---|---|
JsonContent<Object> |
from(byte[] source)
Create JSON content from the specified JSON bytes.
|
JsonContent<Object> |
from(CharSequence source)
Create JSON content from the specified String source.
|
JsonContent<Object> |
from(File source)
Create JSON content from the specified JSON file.
|
JsonContent<Object> |
from(InputStream source)
Create JSON content from the specified JSON input stream.
|
JsonContent<Object> |
from(Resource source)
Create JSON content from the specified JSON resource.
|
JsonContent<Object> |
from(String path,
Class<?> resourceLoadClass)
Create JSON content from the specified resource path.
|
public BasicJsonTester(Class<?> resourceLoadClass)
BasicJsonTester
instance.resourceLoadClass
- the source class used to load resourcespublic JsonContent<Object> from(CharSequence source)
.json
, the name of a resource to be loaded
using resourceLoadClass
.source
- JSON content or a .json
resource namepublic JsonContent<Object> from(String path, Class<?> resourceLoadClass)
path
- the path of the resource to loadresourceLoadClass
- the source class used to load the resourcepublic JsonContent<Object> from(byte[] source)
source
- the bytes of JSONpublic JsonContent<Object> from(File source)
source
- the file containing JSONpublic JsonContent<Object> from(InputStream source)
source
- the input stream containing JSONpublic JsonContent<Object> from(Resource source)
source
- the resource containing JSONCopyright © 2016 Pivotal Software, Inc.. All rights reserved.