Grails
  1. Grails
  2. GRAILS-8530

In unit test, mocks are not cleaned beetween two tests (in same class)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0 final
    • Fix Version/s: 2.0.1
    • Component/s: Testing
    • Labels:
    • Testcase included:
      yes

      Description

      Unit Tests failed if in two tests (in one TestClass) create a mock instance of the same class (see attached testcase).

      Tests errors :

      Running 2 unit tests... 1 of 2
      Output from testFirstCall--
      Running 2 unit tests... 2 of 2
      Output from testSecondCall--
      Failure: testSecondCall(com.zenika.MyControllerTests)
      junit.framework.AssertionFailedError: No more calls to 'callMe' expected at this point. End of demands.
      at grails.test.MockClosureProxy.doBeforeCall(MockClosureProxy.java:66)
      at grails.test.AbstractClosureProxy.call(AbstractClosureProxy.java:74)
      at com.zenika.MyController.index(MyController.groovy:10)
      at com.zenika.MyControllerTests.executeCallTest(MyControllerTests.groovy:31)
      at com.zenika.MyControllerTests.testSecondCall(MyControllerTests.groovy:19)
      Completed 2 unit tests, 1 failed in 3238ms
      Tests FAILED - view reports in target/test-reports

        Activity

        Hide
        boillod manuel added a comment -

        Possible related issues : GRAILS-8454, GRAILS-3615

        Show
        boillod manuel added a comment - Possible related issues : GRAILS-8454 , GRAILS-3615

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            boillod manuel
          • Votes:
            6 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development