[jira] Created: (JMOCK-226) Confusing error message when closing parenthesis is misplaced with multiple Expectations blocks

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

[jira] Created: (JMOCK-226) Confusing error message when closing parenthesis is misplaced with multiple Expectations blocks

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

Reply to Author | View Threaded | Show Only this Message

Confusing error message when closing parenthesis is misplaced with multiple Expectations blocks
-----------------------------------------------------------------------------------------------

                 Key: JMOCK-226
                 URL: http://jira.codehaus.org/browse/JMOCK-226
             Project: jMock
          Issue Type: Improvement
          Components: JMock 2.x.x Library
    Affects Versions: 2.5.1
            Reporter: Pétur Runólfsson
         Attachments: Tester.java

If the closing parenthesis in an expectation is misplaced, as in:

oneOf(service.doMoreStuff());

and another expectation block has already been defined (for example in a @Before method), the error message is very confusing:

unexpected invocation: service.doMoreStuff()
expectations:
  allowed, never invoked: service.doStuff(); returns a default value
what happened before this: nothing!

It would be nice if this could be handled more gracefully. It should be possible to detect fairly accurately if an Expectations block is open, for example by incrementing a static thread local counter in new Expectations() and decrementing it in buildExpectations.

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