use of com.nextdoor.bender.operation.json.key.KeyNameOperation in project bender by Nextdoor.
the class PayloadOperationTest method testNonJsonObject.
@Test(expected = OperationException.class)
public void testNonJsonObject() {
KeyNameOperation operation = new KeyNameOperation();
DummpyEvent devent = new DummpyEvent();
devent.payload = new JsonPrimitive("foo");
InternalEvent ievent = new InternalEvent("", null, 0);
ievent.setEventObj(devent);
operation.perform(ievent);
}
use of com.nextdoor.bender.operation.json.key.KeyNameOperation in project bender by Nextdoor.
the class KeyNameMutatorTest method testMutatePayload.
@Test
public void testMutatePayload() throws JsonSyntaxException, IOException, OperationException {
JsonParser parser = new JsonParser();
JsonElement input = parser.parse(getResourceString("basic_input.json"));
String expectedOutput = getResourceString("basic_output_key_name.json");
DummpyEvent devent = new DummpyEvent();
devent.payload = input.getAsJsonObject();
KeyNameOperation operation = new KeyNameOperation();
InternalEvent ievent = new InternalEvent("", null, 0);
ievent.setEventObj(devent);
operation.perform(ievent);
assertEquals(expectedOutput, input.toString());
}
use of com.nextdoor.bender.operation.json.key.KeyNameOperation in project bender by Nextdoor.
the class PayloadOperationTest method testNullPayload.
@Test
public void testNullPayload() {
KeyNameOperation operation = new KeyNameOperation();
DummpyEvent devent = new DummpyEvent();
devent.payload = null;
InternalEvent ievent = new InternalEvent("", null, 0);
ievent.setEventObj(devent);
InternalEvent output = operation.perform(ievent);
assertEquals(null, output);
}
Aggregations