use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.
the class CreateEventPresenterTest method shouldShowErrorOnFailure.
@Test
public void shouldShowErrorOnFailure() {
Event event = createEventPresenter.getEvent();
when(eventRepository.createEvent(event)).thenReturn(Observable.error(new Throwable("Error")));
String isoDateNow = DateUtils.formatDateToIso(LocalDateTime.now());
String isoDateMax = DateUtils.formatDateToIso(LocalDateTime.MAX);
event.getStartsAt().set(isoDateNow);
event.getEndsAt().set(isoDateMax);
createEventPresenter.createEvent();
verify(createEventView).showError("Error");
}
use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.
the class CreateEventPresenterTest method shouldCloseOnCreated.
@Test
public void shouldCloseOnCreated() {
Event event = createEventPresenter.getEvent();
when(eventRepository.createEvent(event)).thenReturn(Observable.just(event));
String isoDateNow = DateUtils.formatDateToIso(LocalDateTime.now());
String isoDateMax = DateUtils.formatDateToIso(LocalDateTime.MAX);
event.getStartsAt().set(isoDateNow);
event.getEndsAt().set(isoDateMax);
createEventPresenter.createEvent();
verify(createEventView).close();
}
use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.
the class CreateEventPresenterTest method shouldShowSuccessOnCreated.
@Test
public void shouldShowSuccessOnCreated() {
Event event = createEventPresenter.getEvent();
when(eventRepository.createEvent(event)).thenReturn(Observable.just(event));
String isoDateNow = DateUtils.formatDateToIso(LocalDateTime.now());
String isoDateMax = DateUtils.formatDateToIso(LocalDateTime.MAX);
event.getStartsAt().set(isoDateNow);
event.getEndsAt().set(isoDateMax);
createEventPresenter.createEvent();
verify(createEventView).onSuccess("Event Created Successfully");
}
use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.
the class CreateEventPresenterTest method shouldInitializeEvent.
@Test
public void shouldInitializeEvent() {
Event event = createEventPresenter.getEvent();
assertNotNull(event.getStartsAt());
assertNotNull(event.getEndsAt());
}
use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.
the class EventDashboardPresenterTest method shouldNotToggleEventStateOnError.
@Test
public void shouldNotToggleEventStateOnError() {
when(eventRepository.updateEvent(any(Event.class))).thenReturn(ERROR_OBSERVABLE);
// Defined locally as a work around for unexpected failureg
Event event = Event.builder().id(6L).state(Event.STATE_PUBLISHED).build();
eventDashboardPresenter.setEvent(event);
eventDashboardPresenter.toggleState();
assertNotEquals(event.state, Event.STATE_DRAFT);
}
Aggregations