Nat Pryce (JIRA | 11 May 23:23 2009

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


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

Nat Pryce edited comment on JMOCK-224 at 5/11/09 4:22 PM:
----------------------------------------------------------

Why do you care? What exactly are you trying to achieve?

The Throwable base class implements Serializable, so we can't make an ExpectationError
non-serializable.  However, it makes no sense to serialize an ExpectationError because it refers to the
Mockery and other information that is used to diagnose test failures.

      was (Author: npryce):
    Why do you care?

The Throwable base class implements Serializable, so we can't make an ExpectationError
non-serializable.  However, it makes no sense to serialize an ExpectationError because it refers to the
Mockery and other information that is used to diagnose test failures.

> 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


Gmane