use of com.nextdoor.bender.deserializer.DeserializationException in project bender by Nextdoor.
the class BaseHandlerTest method testDeserializationException.
@Test
public void testDeserializationException() throws HandlerException {
BaseHandler.CONFIG_FILE = "/config/handler_config.json";
handler.skipWriteStats = true;
List<DummyEvent> events = new ArrayList<DummyEvent>(1);
events.add(new DummyEvent("foo", 0));
TestContext context = new TestContext();
context.setInvokedFunctionArn("arn:aws:lambda:us-east-1:123:function:test:tag");
handler.init(context);
DeserializerProcessor proc = handler.sources.get(0).getDeserProcessor();
Deserializer deserSpy = spy(proc.getDeserializer());
doThrow(new DeserializationException("expected")).when(deserSpy).deserialize(anyString());
proc.setDeserializer(deserSpy);
handler.handler(events, context);
assertEquals(1, proc.getErrorCountStat().getValue());
}
Aggregations