Strange I was writing a very simple JUnit test using JMockIt. But, it has a compile error.
I wanted to also invoke the original mocked target object in the test. In the state based Mockup API one does this by adding a mockit.Invocation as the first argument to the method signature.
@Mock public String getV(Invocation invocation, String key) { ....... }
Then, the original mocked object is available via: invocation.getInvokedInstance().
It does not work in Eclipse 4.2. I copied the same code and opened the source in Eclipse 3.7. It works. Thus, the issue is Eclipse or a setup difference.
Update
May 19, 2013: I see that the classpath ordering is different as shown in the .classpath config file. Also, the JRE_CONTAINER is different, the one in the Eclipse 4.2 project is using JavaSE-1.7. That should have been jdk1.7.0_13. Will have to retest.
That wasn’t the issue.
Environment
- Windows 7 64bit, AMD PC
- JDK 1.7
- Eclipse 4.2
- JUnit 4
- JMockIt 1.2
