Search in sources :

Example 1 with ObservableString

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

the class TicketCreatePresenterTest method setupMockEvent.

private void setupMockEvent() {
    when(event.getTimezone()).thenReturn("UTC");
    when(event.getEndsAt()).thenReturn(new ObservableString("2018-12-14T23:59:59.123456+00:00"));
}
Also used : ObservableString(org.fossasia.openevent.app.data.models.dto.ObservableString)

Example 2 with ObservableString

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

the class DateServiceTest method testClashPast.

@Test
public void testClashPast() {
    Event pastLatest = new Event();
    String min = DateUtils.formatDateToIso(LocalDateTime.MIN);
    String minPlus5 = DateUtils.formatDateToIso(LocalDateTime.MIN.plusDays(5));
    pastLatest.setStartsAt(new ObservableString(min));
    pastLatest.setEndsAt(new ObservableString(minPlus5));
    assertEquals(1, DateService.compareEventDates(PAST, pastLatest));
}
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)

Example 3 with ObservableString

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

the class DateServiceTest method testClashUpcoming.

@Test
public void testClashUpcoming() {
    Event upcomingEarliest = new Event();
    String max = DateUtils.formatDateToIso(LocalDateTime.MAX);
    String maxMinus5 = DateUtils.formatDateToIso(LocalDateTime.MAX.minusDays(5));
    upcomingEarliest.setStartsAt(new ObservableString(maxMinus5));
    upcomingEarliest.setEndsAt(new ObservableString(max));
    assertEquals(1, DateService.compareEventDates(UPCOMING, upcomingEarliest));
}
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)

Example 4 with ObservableString

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

the class TypeConverterTest method testObservableStringToStringJsonConversion.

@Test
public void testObservableStringToStringJsonConversion() throws JsonProcessingException {
    TestModel model = new TestModel(new ObservableString("John Wick"));
    String json = OBJECT_MAPPER.writeValueAsString(model);
    assertNotNull(json);
    assertEquals("{\"name\":\"John Wick\"}", json);
}
Also used : ObservableString(org.fossasia.openevent.app.data.models.dto.ObservableString) ObservableString(org.fossasia.openevent.app.data.models.dto.ObservableString) Test(org.junit.Test)

Example 5 with ObservableString

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

the class TypeConverterTest method testObservableStringToStringDbConversion.

@Test
public void testObservableStringToStringDbConversion() {
    String value = "John Wick";
    ObservableString observableString = new ObservableString(value);
    assertEquals(value, STRING_CONVERTER.getDBValue(observableString));
}
Also used : ObservableString(org.fossasia.openevent.app.data.models.dto.ObservableString) ObservableString(org.fossasia.openevent.app.data.models.dto.ObservableString) Test(org.junit.Test)

Aggregations

ObservableString (org.fossasia.openevent.app.data.models.dto.ObservableString)7 Test (org.junit.Test)5 Event (org.fossasia.openevent.app.data.models.Event)4