@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());
}