[jira] Created: (JMOCK-220) Using 'ignoring' an expectation overrides the expectation

View: New views
3 Messages — Rating Filter:   Alert me  

[jira] Created: (JMOCK-220) Using 'ignoring' an expectation overrides the expectation

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

Reply to Author | View Threaded | Show Only this Message

Using 'ignoring' an expectation overrides the expectation
---------------------------------------------------------

                 Key: JMOCK-220
                 URL: http://jira.codehaus.org/browse/JMOCK-220
             Project: jMock
          Issue Type: Bug
          Components: Library
    Affects Versions: 2.5.1
            Reporter: robert w. lawson


I want to set an expectation that a particular method (or methods) on a mock are called, but ignore any other methods that are called on that mock.  I've read some posts that say this is easily done by something like:

oneOf (foo).doIt(45);
ignoring (foo);

However, this ignores all calls to the foo mock, including the doIt() method.  The only thing I can do right now to get my test to work is to not use ignoring, and set an expectation on EVERY method of foo that is called.  If I don't, when any method other than doIt() is called, an unexpected method invocation exception is thrown.


--
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



[jira] Closed: (JMOCK-220) Using 'ignoring' an expectation overrides the expectation

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

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/JMOCK-220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nat Pryce closed JMOCK-220.
---------------------------

      Assignee: Nat Pryce
    Resolution: Not A Bug

Please read http://www.jmock.org/dispatch.html to understand the interaction between allowing and oneOf.

> Using 'ignoring' an expectation overrides the expectation
> ---------------------------------------------------------
>
>                 Key: JMOCK-220
>                 URL: http://jira.codehaus.org/browse/JMOCK-220
>             Project: jMock
>          Issue Type: Bug
>          Components: Library
>    Affects Versions: 2.5.1
>            Reporter: robert w. lawson
>            Assignee: Nat Pryce
>
> I want to set an expectation that a particular method (or methods) on a mock are called, but ignore any other methods that are called on that mock.  I've read some posts that say this is easily done by something like:
> oneOf (foo).doIt(45);
> ignoring (foo);
> However, this ignores all calls to the foo mock, including the doIt() method.  The only thing I can do right now to get my test to work is to not use ignoring, and set an expectation on EVERY method of foo that is called.  If I don't, when any method other than doIt() is called, an unexpected method invocation exception is thrown.

--
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



[jira] Commented: (JMOCK-220) Using 'ignoring' an expectation overrides the expectation

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

Reply to Author | View Threaded | Show Only this Message


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

Nat Pryce commented on JMOCK-220:
---------------------------------

It may be useful for jMock to have a 'anyOtherMethod' method-matcher.  However, that can easily mask poor inter-object protocols by letting a test ignore lots of overly complex interactions.  I'm not sure if such a feature would conflict with jMock's purpose as a design tool.  Discussion on the mailing list is welcome...

> Using 'ignoring' an expectation overrides the expectation
> ---------------------------------------------------------
>
>                 Key: JMOCK-220
>                 URL: http://jira.codehaus.org/browse/JMOCK-220
>             Project: jMock
>          Issue Type: Bug
>          Components: Library
>    Affects Versions: 2.5.1
>            Reporter: robert w. lawson
>            Assignee: Nat Pryce
>
> I want to set an expectation that a particular method (or methods) on a mock are called, but ignore any other methods that are called on that mock.  I've read some posts that say this is easily done by something like:
> oneOf (foo).doIt(45);
> ignoring (foo);
> However, this ignores all calls to the foo mock, including the doIt() method.  The only thing I can do right now to get my test to work is to not use ignoring, and set an expectation on EVERY method of foo that is called.  If I don't, when any method other than doIt() is called, an unexpected method invocation exception is thrown.

--
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