Is it possible to override a native method in a Java class in Android/dalvik?
I am unit testing a class TestMe using EasyMock, and one of its methods (say method(N n) ) expects a parameter of type N which has a native method (say nativeMethod() ). class TestMe { void method(N n) { // Do stuff n.nativeMethod(); // Do more stuff } } method() needs to invoke N.nativeMethod() at some point, and the problem I'm having is that my Easymock mock object for N is unable to override the native method. I do not own class N but I can refactor TestMe in any way necessary. I decided to make my own class FakeN extends N which overrides nativeMethod to do nothing: class FakeN extends N