Search in sources :

Example 1 with ScheduleItem

use of com.instructure.canvasapi.model.ScheduleItem in project instructure-android by instructure.

the class ScheduleItemUnitTest method testScheduleItemCalendar.

@Test
public void testScheduleItemCalendar() {
    Gson gson = CanvasRestAdapter.getGSONParser();
    ScheduleItem[] scheduleItems = gson.fromJson(scheduleItemCalendarJSON, ScheduleItem[].class);
    assertNotNull(scheduleItems);
    for (ScheduleItem scheduleItem : scheduleItems) {
        assertNotNull(scheduleItem);
        assertNotNull(scheduleItem.getStartDate());
        assertNotNull(scheduleItem.getTitle());
        assertNotNull(scheduleItem.getContextType());
        assertNotNull(scheduleItem.getHtmlUrl());
        assertTrue(scheduleItem.getId() > 0);
        assertTrue(scheduleItem.getContextId() > 0);
    }
}
Also used : ScheduleItem(com.instructure.canvasapi.model.ScheduleItem) Gson(com.google.gson.Gson) Test(org.junit.Test)

Example 2 with ScheduleItem

use of com.instructure.canvasapi.model.ScheduleItem in project instructure-android by instructure.

the class CalenderEventUnitTest method testCalenderEventList.

@Test
public void testCalenderEventList() {
    Gson gson = CanvasRestAdapter.getGSONParser();
    ScheduleItem[] list = gson.fromJson(upcomingEventsJSON, ScheduleItem[].class);
    assertNotNull(list);
    ScheduleItem listScheduleItem = list[0];
    if (listScheduleItem.isAllDay()) {
        assertNotNull(listScheduleItem.getAllDayDate());
    } else {
        assertFalse(listScheduleItem.isAllDay());
        assertNull(listScheduleItem.getAllDayDate());
    }
    assertTrue(listScheduleItem.getId() > 0);
    assertNotNull(listScheduleItem.getStartDate());
    assertNotNull(listScheduleItem.getEndDate());
    assertNotNull(listScheduleItem.getLocationName());
    assertNotNull(listScheduleItem.getTitle());
    assertNotNull(listScheduleItem.getDescription());
    assertNotNull(listScheduleItem.getLocationAddress());
}
Also used : ScheduleItem(com.instructure.canvasapi.model.ScheduleItem) Gson(com.google.gson.Gson) Test(org.junit.Test)

Example 3 with ScheduleItem

use of com.instructure.canvasapi.model.ScheduleItem in project instructure-android by instructure.

the class CalenderEventUnitTest method testCalenderEvent.

@Test
public void testCalenderEvent() {
    Gson gson = CanvasRestAdapter.getGSONParser();
    ScheduleItem scheduleItem = gson.fromJson(calenderEventJSON, ScheduleItem.class);
    assertNotNull(scheduleItem);
    if (scheduleItem.isAllDay()) {
        assertNotNull(scheduleItem.getAllDayDate());
    } else {
        assertFalse(scheduleItem.isAllDay());
        assertNull(scheduleItem.getAllDayDate());
    }
    assertTrue(scheduleItem.getId() > 0);
    assertNotNull(scheduleItem.getStartDate());
    assertNotNull(scheduleItem.getEndDate());
    assertNotNull(scheduleItem.getLocationName());
    assertNotNull(scheduleItem.getTitle());
    assertNotNull(scheduleItem.getDescription());
    assertNotNull(scheduleItem.getLocationAddress());
}
Also used : ScheduleItem(com.instructure.canvasapi.model.ScheduleItem) Gson(com.google.gson.Gson) Test(org.junit.Test)

Example 4 with ScheduleItem

use of com.instructure.canvasapi.model.ScheduleItem in project instructure-android by instructure.

the class ScheduleItemUnitTest method testScheduleItemAssignment.

@Test
public void testScheduleItemAssignment() {
    Gson gson = CanvasRestAdapter.getGSONParser();
    Assignment[] assignments = gson.fromJson(scheduleItemAssignmentJSON, Assignment[].class);
    assertNotNull(assignments);
    for (Assignment assignment : assignments) {
        ScheduleItem scheduleItem = assignment.toScheduleItem();
        assertNotNull(scheduleItem);
        assertTrue(scheduleItem.getId() > 0);
        assertNotNull(scheduleItem.getTitle());
        assertNotNull(scheduleItem.getType());
    }
}
Also used : Assignment(com.instructure.canvasapi.model.Assignment) ScheduleItem(com.instructure.canvasapi.model.ScheduleItem) Gson(com.google.gson.Gson) Test(org.junit.Test)

Aggregations

Gson (com.google.gson.Gson)4 ScheduleItem (com.instructure.canvasapi.model.ScheduleItem)4 Test (org.junit.Test)4 Assignment (com.instructure.canvasapi.model.Assignment)1