Search in sources :

Example 6 with FieldSubstitution

use of com.nextdoor.bender.operation.substitution.field.FieldSubstitution in project bender by Nextdoor.

the class FieldSubstitutionTest method testRemoveField.

@Test
public void testRemoveField() throws FieldNotFoundException {
    ArrayList<Substitution> substitutions = new ArrayList<Substitution>();
    substitutions.add(new FieldSubstitution("bar", Arrays.asList("foo"), true, true, true));
    DummpyMapEvent devent = new DummpyMapEvent();
    devent.setField("foo", "1234");
    InternalEvent ievent = new InternalEvent("", null, 0);
    ievent.setEventObj(devent);
    SubstitutionOperation op = new SubstitutionOperation(substitutions);
    op.perform(ievent);
    assertEquals(1, devent.payload.size());
    assertEquals("1234", devent.getField("bar"));
}
Also used : FieldSubstitution(com.nextdoor.bender.operation.substitution.field.FieldSubstitution) FieldSubstitution(com.nextdoor.bender.operation.substitution.field.FieldSubstitution) ArrayList(java.util.ArrayList) DummpyMapEvent(com.nextdoor.bender.testutils.DummyDeserializerHelper.DummpyMapEvent) InternalEvent(com.nextdoor.bender.InternalEvent) Test(org.junit.Test)

Aggregations

InternalEvent (com.nextdoor.bender.InternalEvent)6 FieldSubstitution (com.nextdoor.bender.operation.substitution.field.FieldSubstitution)6 DummpyMapEvent (com.nextdoor.bender.testutils.DummyDeserializerHelper.DummpyMapEvent)6 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)5