Add unit test for handling JsonMappingException, fixes #524