For a quick fix have ObjectMethodsFilter implement Serializable. I also subclassed MocksControl implementing Serializable, not sure if that is necessary.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've started to implement it. Making ObjectMethodFilter serializable requires many objects underneath and custom serialization. I'm also trying to keep backward comptatibility with easymock class extension. Should be in check-in soon. However, depending on the impacts, I don't know when it will be officially released
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A test method, might be useful :
@Test
public void testSerializeMockInetAddress() throws IOException
{
InetAddress mockInetAddress = EasyMock.createMock(InetAddress.class);
assertThat(mockInetAddress,instanceOf(Serializable.class));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(mockInetAddress);
final byte[] itaSerialized = baos.toByteArray();
assertThat(itaSerialized,is(not(nullValue())));
}
Currently this test fails with the following stacktrace:
java.io.NotSerializableException: org.easymock.classextension.internal.ClassProxyFactory$1
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
(this code was posted on the official easymock mailing-list, i thought it was useful to keep track of it on the official tracker of the project).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=352203
Originator: NO
For a quick fix have ObjectMethodsFilter implement Serializable. I also subclassed MocksControl implementing Serializable, not sure if that is necessary.
Logged In: YES
user_id=893525
Originator: YES
I've started to implement it. Making ObjectMethodFilter serializable requires many objects underneath and custom serialization. I'm also trying to keep backward comptatibility with easymock class extension. Should be in check-in soon. However, depending on the impacts, I don't know when it will be officially released
Logged In: YES
user_id=930308
Originator: NO
A test method, might be useful :
@Test
public void testSerializeMockInetAddress() throws IOException
{
InetAddress mockInetAddress = EasyMock.createMock(InetAddress.class);
assertThat(mockInetAddress,instanceOf(Serializable.class));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(mockInetAddress);
final byte[] itaSerialized = baos.toByteArray();
assertThat(itaSerialized,is(not(nullValue())));
}
Currently this test fails with the following stacktrace:
java.io.NotSerializableException: org.easymock.classextension.internal.ClassProxyFactory$1
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
(this code was posted on the official easymock mailing-list, i thought it was useful to keep track of it on the official tracker of the project).
Logged In: YES
user_id=893525
Originator: YES
Submitted by Jonathan Locked