use of com.tevinjeffrey.rutgersct.rutgersapi.model.SystemMessage in project Rutgers-Course-Tracker by tevjef.
the class ChooserPresenterImpl method loadSystemMessage.
@Override
public void loadSystemMessage() {
cancePreviousSubscription();
Subscriber<SystemMessage> mSubscriber = new Subscriber<SystemMessage>() {
@Override
public void onCompleted() {
//Noop
}
@Override
public void onError(Throwable e) {
//Noop
}
@Override
public void onNext(SystemMessage systemMessage) {
if (getView() != null) {
getView().showMessage(systemMessage);
}
}
};
mSubsciption = mRetroRutgers.getSystemMessage().doOnSubscribe(new Action0() {
@Override
public void call() {
isLoading = true;
}
}).doOnTerminate(new Action0() {
@Override
public void call() {
isLoading = false;
}
}).subscribeOn(mBackgroundThread).observeOn(mMainThread).subscribe(mSubscriber);
}
use of com.tevinjeffrey.rutgersct.rutgersapi.model.SystemMessage in project Rutgers-Course-Tracker by tevjef.
the class ChooserPresenterImplTest method LoadChooser_CompletesWithData.
@Test
public void LoadChooser_CompletesWithData() throws Exception {
SystemMessage systemMessage = mock(SystemMessage.class);
chooserPresenterImpl.attachView(chooserView);
databaseHandler.addSectionToDb(TestConts.getPrimarySemesterRequest());
when(retroRutgers.getSystemMessage()).thenReturn(Observable.just(systemMessage));
chooserPresenterImpl.loadSystemMessage();
verify(chooserView).showMessage(any(SystemMessage.class));
}
Aggregations