use of com.eventyay.organizer.data.speakerscall.SpeakersCall in project open-event-orga-app by fossasia.
the class CreateSpeakersCallViewModelTest method shouldShowErrorOnFailure.
@Test
public void shouldShowErrorOnFailure() {
String isoDateNow = DateUtils.formatDateToIso(LocalDateTime.now());
String isoDateMax = DateUtils.formatDateToIso(LocalDateTime.MAX);
SPEAKERS_CALL.setStartsAt(isoDateNow);
SPEAKERS_CALL.setEndsAt(isoDateMax);
createSpeakersCallViewModel.setSpeakersCall(SPEAKERS_CALL);
LiveData<SpeakersCall> speakersCallLiveData = createSpeakersCallViewModel.getSpeakersCall();
when(speakersCallRepository.createSpeakersCall(speakersCallLiveData.getValue())).thenReturn(Observable.error(new Throwable(ERROR)));
createSpeakersCallViewModel.getError().observeForever(error);
createSpeakersCallViewModel.createSpeakersCall(EVENT_ID);
InOrder inOrder = Mockito.inOrder(speakersCallRepository, error);
inOrder.verify(speakersCallRepository).createSpeakersCall(SPEAKERS_CALL);
inOrder.verify(error).onChanged(ERROR);
}
use of com.eventyay.organizer.data.speakerscall.SpeakersCall in project open-event-orga-app by fossasia.
the class CreateSpeakersCallViewModelTest method shouldShowSuccessOnUpdated.
@Test
public void shouldShowSuccessOnUpdated() {
String isoDateNow = DateUtils.formatDateToIso(LocalDateTime.now());
String isoDateMax = DateUtils.formatDateToIso(LocalDateTime.MAX);
SPEAKERS_CALL.setStartsAt(isoDateNow);
SPEAKERS_CALL.setEndsAt(isoDateMax);
createSpeakersCallViewModel.setSpeakersCall(SPEAKERS_CALL);
LiveData<SpeakersCall> speakersCallLiveData = createSpeakersCallViewModel.getSpeakersCall();
when(speakersCallRepository.updateSpeakersCall(speakersCallLiveData.getValue())).thenReturn(Observable.just(SPEAKERS_CALL));
createSpeakersCallViewModel.getSuccess().observeForever(success);
createSpeakersCallViewModel.updateSpeakersCall(EVENT_ID);
InOrder inOrder = Mockito.inOrder(speakersCallRepository, success);
inOrder.verify(speakersCallRepository).updateSpeakersCall(SPEAKERS_CALL);
inOrder.verify(success).onChanged("Speakers Call Updated Successfully");
}
use of com.eventyay.organizer.data.speakerscall.SpeakersCall in project open-event-orga-app by fossasia.
the class SpeakersCallRepositoryTest method shouldSetEventOnCreatedSpeakersCall.
@Test
public void shouldSetEventOnCreatedSpeakersCall() {
SpeakersCall created = mock(SpeakersCall.class);
when(repository.isConnected()).thenReturn(true);
when(speakersCallApi.postSpeakersCall(SPEAKERS_CALL)).thenReturn(Observable.just(created));
when(repository.save(eq(SpeakersCall.class), eq(created))).thenReturn(Completable.complete());
speakersCallRepository.createSpeakersCall(SPEAKERS_CALL).subscribe();
verify(created).setEvent(EVENT);
}
use of com.eventyay.organizer.data.speakerscall.SpeakersCall in project open-event-orga-app by fossasia.
the class SpeakersCallRepositoryTest method shouldUpdateUpdatedSpeakersCall.
@Test
public void shouldUpdateUpdatedSpeakersCall() {
SpeakersCall updated = mock(SpeakersCall.class);
when(repository.isConnected()).thenReturn(true);
when(speakersCallApi.updateSpeakersCall(ID, SPEAKERS_CALL)).thenReturn(Observable.just(updated));
when(repository.update(eq(SpeakersCall.class), eq(updated))).thenReturn(Completable.complete());
speakersCallRepository.updateSpeakersCall(SPEAKERS_CALL).subscribe();
verify(repository).update(SpeakersCall.class, updated);
}
Aggregations