use of com.nextdoor.bender.testutils.DummyDeserializerHelper.DummyStringEvent in project bender by Nextdoor.
the class TimeOperationTest method testValidISO8601Ms.
@Test
public void testValidISO8601Ms() throws FieldNotFoundException {
InternalEvent ievent = new InternalEvent("foo", null, 1);
DummyStringEvent devent = spy(new DummyStringEvent(""));
ievent.setEventObj(devent);
doReturn("2020-05-04T10:45:01.480Z").when(devent).getFieldAsString("foo");
TimeOperation op = new TimeOperation("foo", TimeFieldType.ISO8601);
op.perform(ievent);
assertEquals(1588589101480l, ievent.getEventTime());
}
use of com.nextdoor.bender.testutils.DummyDeserializerHelper.DummyStringEvent in project bender by Nextdoor.
the class TimeOperationTest method testInvalidTime.
@Test(expected = OperationException.class)
public void testInvalidTime() throws FieldNotFoundException {
InternalEvent ievent = new InternalEvent("foo", null, 1);
DummyStringEvent devent = spy(new DummyStringEvent(""));
ievent.setEventObj(devent);
doReturn("-1").when(devent).getFieldAsString("foo");
TimeOperation op = new TimeOperation("foo", TimeFieldType.SECONDS);
op.perform(ievent);
}
use of com.nextdoor.bender.testutils.DummyDeserializerHelper.DummyStringEvent in project bender by Nextdoor.
the class TimeOperationTest method testValidISO8601Ds.
@Test
public void testValidISO8601Ds() throws FieldNotFoundException {
InternalEvent ievent = new InternalEvent("foo", null, 1);
DummyStringEvent devent = spy(new DummyStringEvent(""));
ievent.setEventObj(devent);
doReturn("2020-05-04T10:45:01Z").when(devent).getFieldAsString("foo");
TimeOperation op = new TimeOperation("foo", TimeFieldType.ISO8601);
op.perform(ievent);
assertEquals(1588589101000l, ievent.getEventTime());
}
use of com.nextdoor.bender.testutils.DummyDeserializerHelper.DummyStringEvent in project bender by Nextdoor.
the class ConditionalOperationTest method supply.
private void supply(int count, Queue<InternalEvent> input) {
new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < count; i++) {
InternalEvent ievent = new InternalEvent("" + i, null, 1);
ievent.setEventObj(new DummyStringEvent("" + i));
input.add(ievent);
}
input.close();
}
}).start();
}
Aggregations