Search in sources :

Example 11 with Sponsor

use of com.eventyay.organizer.data.sponsor.Sponsor in project open-event-orga-app by fossasia.

the class SponsorRepositoryTest method shouldSetEventOnCreatedSponsor.

@Test
public void shouldSetEventOnCreatedSponsor() {
    Sponsor created = mock(Sponsor.class);
    when(repository.isConnected()).thenReturn(true);
    when(sponsorApi.postSponsor(SPONSOR)).thenReturn(Observable.just(created));
    when(repository.save(eq(Sponsor.class), eq(created))).thenReturn(Completable.complete());
    sponsorRepository.createSponsor(SPONSOR).subscribe();
    verify(created).setEvent(EVENT);
}
Also used : Sponsor(com.eventyay.organizer.data.sponsor.Sponsor) Test(org.junit.Test)

Aggregations

Sponsor (com.eventyay.organizer.data.sponsor.Sponsor)11 Test (org.junit.Test)9 InOrder (org.mockito.InOrder)6 VisibleForTesting (androidx.annotation.VisibleForTesting)2 LiveData (androidx.lifecycle.LiveData)2 ViewModel (androidx.lifecycle.ViewModel)2 ContextManager (com.eventyay.organizer.common.ContextManager)2 SingleEventLiveData (com.eventyay.organizer.common.livedata.SingleEventLiveData)2 Logger (com.eventyay.organizer.common.rx.Logger)2 Event (com.eventyay.organizer.data.event.Event)2 SponsorRepository (com.eventyay.organizer.data.sponsor.SponsorRepository)2 ErrorUtils (com.eventyay.organizer.utils.ErrorUtils)2 StringUtils (com.eventyay.organizer.utils.StringUtils)2 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)2 Inject (javax.inject.Inject)2 ArrayList (java.util.ArrayList)1 ArgumentMatchers.anyLong (org.mockito.ArgumentMatchers.anyLong)1