Jmockit: Can't mock method toString of net.android.Uri class
问题 IDE: Android Studio 2.2.2 | Jmockit: 2.1 | Java: 1.8.0_102-b14 I tried to mock method toString() of class net.android.Uri. All method on this class could mock OK, but toString() method. @Test public void method(@Mocked final Uri uri) throws Exception { new NonStrictExpectations() { { uri.getHost(); result = "sendViewLog"; uri.getAuthority(); result = "getAuthority"; uri.getEncodedFragment(); result = "getEncodedFragment"; uri.getPort(); result = 8080; uri.toString(); // <------- result =