If you’re using a version of JMock prior to 2.6.0 and use
@RunWith(JMock.class) you may have spotted that your
@Rules are actually being ignored when running JUnit tests. This could mean false positives. It’s because older versions of the
JUnit4ClassRunner ignores rules.
The good news is that JMock 2.6.0 and above use the newer
BlockJUnit4ClassRunner and this does support rules. Bear this in mind when working with any class and the
@RunWith as they may also extend the rule ignoring runner.