use of org.whole.lang.json.util.JSONGeneratorBuilderOperation in project whole by wholeplatform.
the class JSONPersistencesTest method testParseAndGenerateWithBuilderOperation.
@Test
public void testParseAndGenerateWithBuilderOperation() throws Exception {
IEntity sampleModel = JSONSourcePersistenceKit.instance().readModel(new StreamPersistenceProvider(getClass().getResourceAsStream("sample.json")));
StringPersistenceProvider pp = new StringPersistenceProvider();
JsonGenerator generator = new JsonFactory().createGenerator(pp.getOutputStream());
generator.useDefaultPrettyPrinter();
JSONGeneratorBuilderOperation op = new JSONGeneratorBuilderOperation(generator);
new ModelTemplate(sampleModel).apply(op);
generator.close();
assertEquals(sampleString, pp.getStore());
}
Aggregations