on-internet
← Community

Throwing custom exception from Jackson Serializer in Java

Stack Overflow ·

I was wondering if anyone could help - I am writing a custom Json serializer, extending from JsonSerializer, and I want to wrap any exceptions that could be thrown in my own custom exception, extended from IOException. However, whenever I run any unit tests (using junit) to confirm that the exception is thrown it is failing, saying that - Expected: (exception with message a string containing "Unable to serialize!" and an instance of com.company.profile.serializer.MySerializerException) got: <com.fasterxml.jackson.databind.JsonMappingException: Unexpected IOException (of type com.company.profil

Comments

Sign in or sign up to comment and upvote.

No comments yet.