Skip to content

Add TearDown() to Mocks #753

@numeralnathan

Description

@numeralnathan

Previously, JMockit had a tearDown() method for mocks. In most cases, it makes sense to remove this method. This way mocks have a definite lifetime of a test method, class, suite, etc. I have encountered a situation where I need to create a mock for class initialization but then disable the mock for the rest of the test cases. In my MockUp class, I add a private boolean field and a disable() to turn off the mock. This is cumbersome and requires extra work on my part. Please re-add a tearDown() method so that it is easy to remove a mock that is no longer needed during initialization and hence the mock is not active for the rest of the test cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions