jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
EasyMock
  • EasyMock
  • EASYMOCK-104

Expectation failure

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 3.0
  • Fix Version/s: 3.1
  • Component/s: Core
  • Labels:
    None
  • Source ID:
    http://sourceforge.net/support/tracker.php?aid=3425228
  • Number of attachments :
    0

Description

In the AssertionError that is thrown for expectation failures the name of the mocked interface should be mentioned. Otherwise you might have a hard time to find the method if you have many mocks at the same time.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Henri Tremblay added a comment - 02/Nov/11 7:08 PM

Are we talking about the "Unexpected method call" message?

If yes, it's not possible to give it a name since more than one mock can be on the same mock control. However, looking at the line in the stack trace is usually enough (unless you are looping over mocks and then I would suggest to add dedicated message manually.

Show
Henri Tremblay added a comment - 02/Nov/11 7:08 PM Are we talking about the "Unexpected method call" message? If yes, it's not possible to give it a name since more than one mock can be on the same mock control. However, looking at the line in the stack trace is usually enough (unless you are looping over mocks and then I would suggest to add dedicated message manually.
Hide
Permalink
Hans-Peter Störr added a comment - 04/Nov/11 3:05 AM - edited

For the "unexpected method call" the stacktrace is in my experience enough, indeed. However I was talking about the messages that can occur during verify, e.g.:
java.lang.AssertionError:
Expectation failure on verify:
getArray(15): expected: 1, actual: 0
at org.easymock.internal.MocksControl.verify(MocksControl.java:184)
at org.easymock.EasyMock.verify(EasyMock.java:2038)
That is not a lot of help if there are several interfaces that have a method getArray, and even if there is only one it can be a little annoying to find out which one. In many tests we have 10 or more mocks.
By the way: if the mock has a name that probably should be put into the message as well.

Show
Hans-Peter Störr added a comment - 04/Nov/11 3:05 AM - edited For the "unexpected method call" the stacktrace is in my experience enough, indeed. However I was talking about the messages that can occur during verify, e.g.: java.lang.AssertionError: Expectation failure on verify: getArray(15): expected: 1, actual: 0 at org.easymock.internal.MocksControl.verify(MocksControl.java:184) at org.easymock.EasyMock.verify(EasyMock.java:2038) That is not a lot of help if there are several interfaces that have a method getArray, and even if there is only one it can be a little annoying to find out which one. In many tests we have 10 or more mocks. By the way: if the mock has a name that probably should be put into the message as well.
Henri Tremblay made changes - 06/Nov/11 1:01 PM
Field Original Value New Value
Status Open [ 1 ] In Progress [ 3 ]
Henri Tremblay made changes - 06/Nov/11 1:02 PM
Status In Progress [ 3 ] Resolved [ 5 ]
Fix Version/s 3.1 [ 17672 ]
Resolution Fixed [ 1 ]
Henri Tremblay made changes - 06/Nov/11 1:02 PM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
Hide
Permalink
Henri Tremblay added a comment - 06/Nov/11 5:04 PM

The class name is now printed if the mocked isn't named. This is the case for a failed expectation and for a verify.

Show
Henri Tremblay added a comment - 06/Nov/11 5:04 PM The class name is now printed if the mocked isn't named. This is the case for a failed expectation and for a verify.
Henri Tremblay made changes - 06/Nov/11 5:04 PM
Status Reopened [ 4 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Henri Tremblay made changes - 09/Nov/11 7:53 PM
Status Resolved [ 5 ] Closed [ 6 ]

People

  • Assignee:
    Henri Tremblay
    Reporter:
    Henri Tremblay
Vote (1)
Watch (0)

Dates

  • Created:
    30/Oct/11 4:52 PM
    Updated:
    09/Nov/11 7:53 PM
    Resolved:
    06/Nov/11 5:04 PM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.