We use two different IDEs, Netbeans 8.2 and Eclipse 4.7.2. We are running JMock 2.8.3 with JUnit 4.11 and have a test that fails under Netbeans and Jenkins (using the Netbean's Ant scripts), but passes under Eclipse.
The error is "not all expectations were satisfied".
However, if I add an assertIsSatisfied() call to the end of the test, it will fail with the correct error message under Eclipse.
I can reproduce this with a trivial example:
public class FailureExample {
private static class Example {
public void doSomething() { }
public void doSomethingElse() { }
}
// Mocks
@Rule public JUnitRuleMockery context = new JUnitRuleMockery(){{
setThreadingPolicy(new Synchroniser());
setImposteriser(ClassImposteriser.INSTANCE);
}};
public Example instance;
@Before
public void setUp() throws Exception {
// Mocks
instance = context.mock(Example.class);
}
@Test
public void testExample() {
context.checking(new Expectations() {{
oneOf(instance).doSomething();
oneOf(instance).doSomethingElse();
}});
instance.doSomething();
}
}
Is there something else I need to do in Eclipse to make JMock behave as expected?
Update
Adding screenshot of our project's libraries:
UPDATE I tried create a new Java project as well as a new Maven project (as described below by Till Brychcy) as those worked. I tried removing all the jar files listed for my project and then readding them, but it failed.
I'm very close to abandoning Eclipse in favor of Netbeans, simply because I have real work to do, not just fighting with Eclipse.