我在我的App中使用Android SDK for Facebook.Everything工作正常!

我想做的就是 test onError()用例 . 我有一些函数,如果它从facebook sdk获得onError()回调,则会打开一个对话框的登陆活动 .

如何测试onError()回调?

我说它确实通过了facebook SDK文档

/**
 * A callback class for the Facebook SDK.
 */
public interface FacebookCallback<RESULT> {
    public void onSuccess(RESULT result);
    public void onCancel();

    /**
     * Called when the dialog finishes with an error.
     *
     * @param error The error that occurred
     */
    public void onError(FacebookException error);
}

它返回onSuccess()或大多数Facebook错误显示在其对话框本身,并在按下或取消Facebook登录对话框时返回onCancel()回调 .

enter image description here