If you want to serialize a mock everything needs to be serializable, including the Answer
.
And actually that's what the JDK is telling you :
java.io.NotSerializableException: com.trust1t.ocs.signcore.test.InvalidInputTestCase$1
where InvalidInputTestCase$1
is the name of the anonymous Answer
.
To make it serializable you have to create a class implementing Answer
and Serializable
.
Also note that serialization across classloaders (JVM) is not yet released, at the moment you can only serialize and deserialize a mock in the same classloader.