public void loadStore(){
getStoreUseCase.execute()
.subscribe(new Subscriber<Store>() {
@Override
public void onSuccess(Store store) {
}
@Override
public void onError(Throwable throwable) {
super.onError(throwable);
}
}
@Override
public void onUnauthorized(Throwable throwable) {
}
});
}
GetStoreUseCase如下:
公共类GetStoreUseCase扩展了AbstractUseCase {
private Throwable mException = new Exception();
@Override
public Observable<Store> buildUseCase() {
mGlhManager = new GlhApiManager();
mWalkId = mGlhManager
.createStore(SessionData.getInstance().getConfiguration().getLocationId())
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.onErrorReturn(new Func1<Throwable, StoreWalk>() {
@Override
public Store call(Throwable throwable) {
mException = throwable;
return new Store();
}
})
.toBlocking()
.first()
.getWalkId();
}
if (mWalkId == null) {
return Observable.error(mException);
}
return mGlhManager
.getStoreWalkWithParameters(mLocation, mWalkId, mFieldParameters);
}
}
我总是收到订户的OnError和nullPointer异常。如何测试OnSuccess方法?