JMockIt method not found in type when using Invocation arg

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

Similar Posts:

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

3 thoughts on “JMockIt method not found in type when using Invocation arg”

Leave a Reply

Your email address will not be published. Required fields are marked *