Search in sources :

Example 21 with Event

use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.

the class EventDashboardPresenterTest method shouldHideProgressbarOnToggleError.

@Test
public void shouldHideProgressbarOnToggleError() {
    when(eventRepository.updateEvent(any(Event.class))).thenReturn(Observable.error(Logger.TEST_ERROR));
    eventDashboardPresenter.setEvent(EVENT);
    eventDashboardPresenter.toggleState();
    InOrder inOrder = Mockito.inOrder(eventDetailView, eventRepository);
    inOrder.verify(eventRepository).updateEvent(any(Event.class));
    inOrder.verify(eventDetailView).showProgress(true);
    inOrder.verify(eventDetailView).showResult(any(Event.class));
    inOrder.verify(eventDetailView).showProgress(false);
}
Also used : InOrder(org.mockito.InOrder) Event(org.fossasia.openevent.app.data.models.Event) Test(org.junit.Test)

Example 22 with Event

use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.

the class EventsPresenterTest method shouldShowEmptyViewOnNoItemAfterSwipeRefresh.

@Test
public void shouldShowEmptyViewOnNoItemAfterSwipeRefresh() {
    ArrayList<Event> events = new ArrayList<>();
    when(eventRepository.getEvents(true)).thenReturn(Observable.fromIterable(events));
    InOrder inOrder = Mockito.inOrder(eventListView);
    eventsActivityPresenter.loadUserEvents(true);
    inOrder.verify(eventListView).showEmptyView(false);
    inOrder.verify(eventListView).showResults(events);
    inOrder.verify(eventListView).showEmptyView(true);
}
Also used : InOrder(org.mockito.InOrder) ArrayList(java.util.ArrayList) Event(org.fossasia.openevent.app.data.models.Event) Test(org.junit.Test)

Example 23 with Event

use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.

the class FragmentInstanceTest method setUpMockEvent.

private void setUpMockEvent() {
    Event event = new Event();
    event.timezone = "UTC";
    event.endsAt = new ObservableString("2018-12-14T23:59:59.123456+00:00");
    ContextManager.setSelectedEvent(event);
}
Also used : ObservableString(org.fossasia.openevent.app.data.models.dto.ObservableString) Event(org.fossasia.openevent.app.data.models.Event)

Example 24 with Event

use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.

the class DateServiceTest method testClashLive.

@Test
public void testClashLive() {
    Event liveLatest = new Event();
    String nowMinus5 = DateUtils.formatDateToIso(LocalDateTime.now().minusDays(5));
    String nowPlus5 = DateUtils.formatDateToIso(LocalDateTime.now().plusDays(5));
    liveLatest.setStartsAt(new ObservableString(nowMinus5));
    liveLatest.setEndsAt(new ObservableString(nowPlus5));
    assertEquals(1, DateService.compareEventDates(LIVE, liveLatest));
}
Also used : ObservableString(org.fossasia.openevent.app.data.models.dto.ObservableString) Event(org.fossasia.openevent.app.data.models.Event) ObservableString(org.fossasia.openevent.app.data.models.dto.ObservableString) Test(org.junit.Test)

Aggregations

Event (org.fossasia.openevent.app.data.models.Event)24 Test (org.junit.Test)19 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 ObservableString (org.fossasia.openevent.app.data.models.dto.ObservableString)4 InOrder (org.mockito.InOrder)3 Completable (io.reactivex.Completable)2 TestObserver (io.reactivex.observers.TestObserver)2 Place (com.google.android.gms.location.places.Place)1 ArrayList (java.util.ArrayList)1 Logger (org.fossasia.openevent.app.common.rx.Logger)1 DatabaseRepository (org.fossasia.openevent.app.data.db.DatabaseRepository)1 Attendee (org.fossasia.openevent.app.data.models.Attendee)1 Ticket (org.fossasia.openevent.app.data.models.Ticket)1 TicketRepository (org.fossasia.openevent.app.data.repository.TicketRepository)1