use of com.nextdoor.bender.operation.json.key.JsonRootNodeOperationFactory in project bender by Nextdoor.
the class JsonRootNodeMutatorTest method testMutateRootNode.
@Test
public void testMutateRootNode() throws JsonSyntaxException, UnsupportedEncodingException, IOException {
JsonParser parser = new JsonParser();
JsonElement input = parser.parse(getResourceString("basic_input.json"));
DummpyEvent devent = new DummpyEvent();
devent.payload = input.getAsJsonObject();
JsonRootNodeOperationFactory f = new JsonRootNodeOperationFactory();
JsonRootNodeOperation operation = new JsonRootNodeOperation("$.i.ia");
InternalEvent ievent = new InternalEvent("", null, 0);
ievent.setEventObj(devent);
operation.perform(ievent);
assertEquals("{\"iaa\":\"bar\"}", devent.payload.toString());
}
Aggregations