use of com.eventyay.organizer.data.copyright.Copyright in project open-event-orga-app by fossasia.
the class UpdateCopyrightViewModel method updateCopyright.
public void updateCopyright() {
nullifyEmptyFields(copyright);
if (!verifyYear(copyright))
return;
long eventId = ContextManager.getSelectedEvent().getId();
Event event = new Event();
event.setId(eventId);
copyright.setEvent(event);
compositeDisposable.add(copyrightRepository.updateCopyright(copyright).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> progress.setValue(false)).subscribe(updatedTicket -> {
success.setValue("Copyright Updated");
dismiss.call();
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
use of com.eventyay.organizer.data.copyright.Copyright in project open-event-orga-app by fossasia.
the class CopyrightRepositoryTest method shouldSetEventOnCreatedCopyright.
@Test
public void shouldSetEventOnCreatedCopyright() {
Copyright created = mock(Copyright.class);
when(repository.isConnected()).thenReturn(true);
when(copyrightApi.postCopyright(COPYRIGHT)).thenReturn(Observable.just(created));
when(repository.save(eq(Copyright.class), eq(created))).thenReturn(Completable.complete());
copyrightRepository.createCopyright(COPYRIGHT).subscribe();
verify(created).setEvent(EVENT);
}
use of com.eventyay.organizer.data.copyright.Copyright in project open-event-orga-app by fossasia.
the class CopyrightRepositoryTest method shouldSaveCreatedCopyright.
@Test
public void shouldSaveCreatedCopyright() {
Copyright created = mock(Copyright.class);
when(repository.isConnected()).thenReturn(true);
when(copyrightApi.postCopyright(COPYRIGHT)).thenReturn(Observable.just(created));
when(repository.save(eq(Copyright.class), eq(created))).thenReturn(Completable.complete());
copyrightRepository.createCopyright(COPYRIGHT).subscribe();
verify(repository).save(Copyright.class, created);
}
Aggregations