use of com.eventyay.organizer.data.session.Session in project open-event-orga-app by fossasia.
the class CreateSessionViewModelTest method shouldShowSuccessOnUpdated.
@Test
public void shouldShowSuccessOnUpdated() {
Session session = createSessionViewModel.getSession();
String isoDateNow = DateUtils.formatDateToIso(LocalDateTime.now());
String isoDateThen = DateUtils.formatDateToIso(LocalDateTime.MAX);
session.setStartsAt(isoDateNow);
session.setEndsAt(isoDateThen);
when(sessionRepository.updateSession(createSessionViewModel.getSession())).thenReturn(Observable.just(SESSION));
InOrder inOrder = Mockito.inOrder(progress, success, dismiss);
createSessionViewModel.getProgress().observeForever(progress);
createSessionViewModel.getSuccess().observeForever(success);
createSessionViewModel.getDismiss().observeForever(dismiss);
createSessionViewModel.updateSession(TRACK_ID, EVENT_ID);
inOrder.verify(progress).onChanged(true);
inOrder.verify(success).onChanged(anyString());
inOrder.verify(dismiss).onChanged(null);
inOrder.verify(progress).onChanged(false);
}
use of com.eventyay.organizer.data.session.Session in project open-event-orga-app by fossasia.
the class SessionRepositoryTest method shouldUpdateUpdatedSession.
@Test
public void shouldUpdateUpdatedSession() {
Session updated = mock(Session.class);
when(repository.isConnected()).thenReturn(true);
when(sessionApi.updateSession(ID, SESSION)).thenReturn(Observable.just(updated));
when(repository.update(eq(Session.class), eq(updated))).thenReturn(Completable.complete());
sessionRepository.updateSession(SESSION).subscribe();
verify(repository).update(Session.class, updated);
}
Aggregations