use of com.nextdoor.bender.serializer.Serializer in project bender by Nextdoor.
the class BaseHandlerTest method testSerializationException.
@Test
public void testSerializationException() throws HandlerException, SerializationException {
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);
Serializer serSpy = spy(handler.ser.getSerializer());
doThrow(new DeserializationException("")).when(serSpy).serialize(any());
handler.ser.setSerializer(serSpy);
handler.handler(events, context);
assertEquals(1, handler.ser.getErrorCountStat().getValue());
}
Aggregations