我正在使用power mock来为静态构造函数
创建和初始化对象PowerMockito.when(RequestHandler.getInstance(coordinatorLayout,getSystemContext())).thenReturn(handler);
但在运行测试时我获得了:
无法模拟RequestHandler对象的构造 cz.msebera.android.httpclient.conn.ssl.SSLInitializationException
public RequestHandler(){
this.client = new AsyncHttpClient();
}
public static RequestHandler getInstance(CoordinatorLayout coordinatorLayout,Context context){
if(instance == null){
instance = new RequestHandler();
}
instance.coordinatorLayout = coordinatorLayout;
instance.context=context;
notificationProvider=new NotificationProvider(coordinatorLayout);
instance.myUserSessionManager=new MyUserSessionManager(context);
return instance;
}
`