0
如何測試當前的方法?我不能達到像方法1,方法2等內部方法。我試圖在與Mockito不同的測試中測試所有內部方法。那可能嗎?Mockito測試RestClient aSync
@Override
public void myMethod(JSONObject json, final Listener listener) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
RestClientAPI.aSyncPost(url, request, contentType, new JsonHttpResponseHandler() {
@Override
public void onStart() {
super.onStart();
listener.method1();
}
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
listener.method2(response);
}
@Override
public void onFailure(int statusCode, Header[] headers, final String responseString, Throwable throwable) {
listener.method3(responseString);
}
@Override
public void onFinish() {
super.onFinish();
listener.method4();
}
});
}