Grails

classes mocked using mockFor() not getting reset between tests

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0-RC3
  • Fix Version/s: 2.0 final
  • Component/s: Testing
  • Labels:
    None

Description

I've run across a situation where I'm getting "No more calls to 'MOCKED_METHOD' expected at this point..." exceptions in unit tests that shouldn't be dealing with any mocks. Attached is a bug-report that illustrates this, with comments in MyControllerTests.groovy as to how to get the tests w/no mocks to pass.

My app that began throwing these worked fine with a similar pattern of test methods up until 2.0-RC2.

$ grails test-app -unit
| Running 3 unit tests... 3 of 3
| Failure:  testIndexWithoutUsingMockForAgain(mockfor.MyControllerTests)
|  junit.framework.AssertionFailedError: No more calls to 'isMockForWorking' expected at this point. End of demands.
	at grails.test.MockClosureProxy.doBeforeCall(MockClosureProxy.java:66)
	at grails.test.AbstractClosureProxy.call(AbstractClosureProxy.java:74)
	at mockfor.MyController.index(MyController.groovy:6)
	at mockfor.MyControllerTests.testIndexWithoutUsingMockForAgain(MyControllerTests.groovy:32)
| Completed 3 unit tests, 1 failed in 2840ms
| Tests FAILED  - view reports in target/test-reports

Activity

There are no comments yet on this issue.

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: