I'm having problems using the unit test java code, which at some point calls its own methods. Basically, I'm trying to use PowerMockito to mock a class that will eventually call native. I was able to make fun of non-void methods just fine, but I keep getting compilation errors when I try to make fun of a method like return void. Here is an example of the code I'm trying to verify:
public class ClassThatCallsNative { void initObject(ByteBuffer param1, int param2) {
I have this code in my test class:
PowerMockito.when(mClassThatCallsNative.getId(Mockit.anyInt())).thenReturn(0);
This line of code compiles just fine, but the following line contains a compilation error:
PowerMockito.when(mClassThatCallsNative.initObject(Mockit.any(ByteBuffer.class), anyInt())).doNothing();
The error message simply indicates an invalid void parameter and points to .initObject. Any idea what I'm doing wrong?
source share