Uploaded image for project: 'Unitils'
  1. Unitils
  2. UNI-232

EasyMockUnitils - Add reset() method

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.3
    • Component/s: easymock
    • Labels:
      None

      Description

      For now, EasyMockUnitils offers methods replay() and verify() which call corresponding method on easymock MocksControl class, for each mock created with Unitils.

      The problem i'm facing now is that I run my unit test (JUnit 4) with a runner which is not Unitils, and use EasyMockUnitils to create my mock.
      As I don't use UnitilsRunner class, the mock created are not cleared (before test setup) and stay present in the EasyMockModule, which throw an exception when I replay mocks in the second test:

      java.lang.IllegalStateException: This method must not be called in replay state.
      at org.easymock.internal.MocksControl.replay(MocksControl.java:174)
      at org.unitils.easymock.EasyMockModule.replay(EasyMockModule.java:206)
      at org.unitils.easymock.EasyMockUnitils.replay(EasyMockUnitils.java:157)
      at HelloworldTest.testSayGoodbye(HelloworldTest.java:36)
      ...

      It could be great to have methods which reset and clear all created mocks, in case we use EasyMockUnitils without UnitilsRunner.

        Attachments

          Activity

            People

            • Assignee:
              jeroen@hypernation.be Jeroen H.
              Reporter:
              ampton ampton
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: