« Return to Thread: [jira] Created: (JMOCK-224) ExpectationError is Serializable but cannot be Serialized

[jira] Commented: (JMOCK-224) ExpectationError is Serializable but cannot be Serialized

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View in Thread


    [ http://jira.codehaus.org/browse/JMOCK-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=175375#action_175375 ]

Nat Pryce commented on JMOCK-224:
---------------------------------

If you want to serialise throwables that report expectation failures, you can plug your own ErrorTranslator into the Mockery that translates ExpectationErrors into an ErrorType that is serializable.

> ExpectationError is Serializable but cannot be Serialized
> ---------------------------------------------------------
>
>                 Key: JMOCK-224
>                 URL: http://jira.codehaus.org/browse/JMOCK-224
>             Project: jMock
>          Issue Type: Bug
>          Components: JMock 2.x.x Library
>    Affects Versions: 2.5.1
>            Reporter: Peter Lawrey
>
> In the following test ExpectationError cannot be Serialized as it has a number of non-transient fields whichc annot be serialized.
> {code:java}
> private static final Mockery MOCKERY = new Mockery();
> public static void test_expectationErrorSerialization() throws IOException {
>     try {
>         final List list = MOCKERY.mock(List.class);
>         MOCKERY.checking(new Expectations() {{
>             oneOf(list).add(1);
>         }});
>         list.add(2);
>         MOCKERY.assertIsSatisfied();
>     } catch (Throwable e) {
>         assertTrue(e instanceof Serializable);
>         ObjectOutputStream oos = new ObjectOutputStream(new ByteArrayOutputStream());
>         oos.writeObject(e);
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: [jira] Created: (JMOCK-224) ExpectationError is Serializable but cannot be Serialized