Search in sources :

Example 1 with LowerCaseKeyOperation

use of com.nextdoor.bender.operation.json.key.LowerCaseKeyOperation in project bender by Nextdoor.

the class LowerCaseKeyMutatorTest method testMutatePayload.

@Test
public void testMutatePayload() throws JsonSyntaxException, IOException, OperationException {
    JsonParser parser = new JsonParser();
    JsonElement input = parser.parse(getResourceString("basic_input_case.json"));
    String expectedOutput = getResourceString("basic_output_case.json");
    DummpyEvent devent = new DummpyEvent();
    devent.payload = input.getAsJsonObject();
    LowerCaseKeyOperation operation = new LowerCaseKeyOperation();
    InternalEvent ievent = new InternalEvent("", null, 0);
    ievent.setEventObj(devent);
    operation.perform(ievent);
    assertEquals(expectedOutput, input.toString());
}
Also used : LowerCaseKeyOperation(com.nextdoor.bender.operation.json.key.LowerCaseKeyOperation) JsonElement(com.google.gson.JsonElement) JsonParser(com.google.gson.JsonParser) InternalEvent(com.nextdoor.bender.InternalEvent) Test(org.junit.Test) OperationTest(com.nextdoor.bender.operations.json.OperationTest)

Aggregations

JsonElement (com.google.gson.JsonElement)1 JsonParser (com.google.gson.JsonParser)1 InternalEvent (com.nextdoor.bender.InternalEvent)1 LowerCaseKeyOperation (com.nextdoor.bender.operation.json.key.LowerCaseKeyOperation)1 OperationTest (com.nextdoor.bender.operations.json.OperationTest)1 Test (org.junit.Test)1