GenericJsonEvent implements DeserializedEvent { @Override public void deleteField(String fieldName) { if (this.payload == null) { return; } JsonPathProvider.delete(this.payload, fieldName); } GenericJsonEvent(JsonObject payload); @Override Object getPayload(); @Override Object getField(String field); @Override void setPayload(Object object); @Override void setField(String fieldName, Object value); @Override String getFieldAsString(String fieldName); @Override Object removeField(String fieldName); @Override void deleteField(String fieldName); @Override GenericJsonEvent copy();  }
@Test public void testDeleteField() throws FieldNotFoundException { GenericJsonEvent event = getEmptyEvent(); event.setField("$.foo", "bar"); event.setField("$.baz", "qux"); JsonObject payload = (JsonObject) event.getPayload(); event.deleteField("$.foo"); assertEquals(2, payload.size()); assertEquals(null, payload.get("foo")); assertEquals("qux", payload.get("baz").getAsString()); assertEquals("b", payload.get("a").getAsString()); }