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

      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

        Hide
        Henri Tremblay added a comment -

        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 - 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
        Hans-Peter Störr added a comment - - 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 - - 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.
        Hide
        Henri Tremblay added a comment -

        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 - The class name is now printed if the mocked isn't named. This is the case for a failed expectation and for a verify.

          People

          • Assignee:
            Henri Tremblay
            Reporter:
            Henri Tremblay
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: