keeganwitt / gmock

Automatically exported from code.google.com/p/gmock
6 stars 2 forks source link

Fix the actual called count in error messages #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Consider:
  def mockLoader = mock()
  mockLoader.load(3).returns(4).atMost(2)
  play {
    3.times { mockLoader.load(3) }
  }

The error message is:
  Unexpected method call 'load(3)'
    'load(3)': expected at most 2, actual 2

I think the actual called count should be 3 in the message, so the user 
can easily find out which method's count is not matched.

Original issue reported on code.google.com by JohnnyJianHY on 24 Nov 2008 at 3:21

GoogleCodeExporter commented 9 years ago
That sound sensible. If I remember correctly Easymock does it that way:
  load(3)': expected at most 2, actual 2+1

I am not sure clean the implementation could be.

Original comment by julien.g...@gmail.com on 25 Nov 2008 at 7:31

GoogleCodeExporter commented 9 years ago
I tried in EasyMock, it is
  'load(3)': expected at most 2, actual 2 (+1)

I will follow that.

Original comment by JohnnyJianHY on 25 Nov 2008 at 7:44

GoogleCodeExporter commented 9 years ago

Original comment by JohnnyJianHY on 25 Nov 2008 at 8:12