use of com.eventyay.organizer.data.tracks.Track in project open-event-orga-app by fossasia.
the class UpdateTrackViewModelTest method shouldShowSuccessOnUpdate.
@Test
public void shouldShowSuccessOnUpdate() {
String successString = "Track Updated";
Track track = updateTrackViewModel.getTrack();
when(trackRepository.updateTrack(track)).thenReturn(Observable.just(track));
ContextManager.setSelectedEvent(event);
InOrder inOrder = Mockito.inOrder(progress, dismiss, success);
updateTrackViewModel.getProgress().observeForever(progress);
updateTrackViewModel.getDismiss().observeForever(dismiss);
updateTrackViewModel.getSuccess().observeForever(success);
updateTrackViewModel.updateTrack();
inOrder.verify(progress).onChanged(true);
inOrder.verify(success).onChanged(successString);
inOrder.verify(dismiss).onChanged(null);
inOrder.verify(progress).onChanged(false);
ContextManager.setSelectedEvent(null);
}
use of com.eventyay.organizer.data.tracks.Track in project open-event-orga-app by fossasia.
the class TrackRepositoryTest method shouldSaveCreatedTrack.
@Test
public void shouldSaveCreatedTrack() {
Track created = mock(Track.class);
when(repository.isConnected()).thenReturn(true);
when(trackApi.postTrack(TRACK)).thenReturn(Observable.just(created));
when(repository.save(eq(Track.class), eq(created))).thenReturn(Completable.complete());
trackRepository.createTrack(TRACK).subscribe();
verify(repository).save(Track.class, created);
}
Aggregations