@Test public void testTerm() { Gson gson = CanvasRestAdapter.getGSONParser(); Term term = gson.fromJson(termJSON, Term.class); assertNotNull(term); assertNotNull(term.getName()); assertTrue(term.getId() > 0); }
@Test public void testNotificationPreference() { Gson gson = CanvasRestAdapter.getGSONParser(); NotificationPreference[] notificationPreferences = gson.fromJson(notificationPreferenceJSON, NotificationPreference[].class); assertNotNull(notificationPreferences); for (NotificationPreference preference : notificationPreferences) { assertNotNull(preference); assertNotNull(preference.notification); assertNotNull(preference.category); assertNotNull(preference.frequency); } }
@Test public void testFiles() { Gson gson = CanvasRestAdapter.getGSONParser(); FileFolder[] files = gson.fromJson(filesJSON, FileFolder[].class); assertNotNull(files); assertEquals(3, files.length); for (FileFolder file : files) { testCommonAttributes(file); assertNotNull(file.getFolderId()); assertNotNull(file.getSize()); assertNotNull(file.getContentType()); assertNotNull(file.getUrl()); assertNotNull(file.getDisplayName()); assertNotNull(file.getThumbnailUrl()); assertNotNull(file.getLockInfo().getUnlockedAt()); } }
@Test public void testFolders() { Gson gson = CanvasRestAdapter.getGSONParser(); FileFolder[] folders = gson.fromJson(foldersJSON, FileFolder[].class); assertNotNull(folders); assertEquals(3, folders.length); for (FileFolder file : folders) { testCommonAttributes(file); assertNotNull(file.getParentFolderId()); assertNotNull(file.getContextId()); assertNotNull(file.getPosition()); assertNotNull(file.getFolders_count()); assertNotNull(file.getContextType()); assertNotNull(file.getName()); assertNotNull(file.getFoldersUrl()); assertNotNull(file.getFilesUrl()); assertNotNull(file.getFullName()); } }
private static BookmarkInterface buildInterface(CanvasCallback<?> callback) { RestAdapter restAdapter = CanvasRestAdapter.buildAdapter(callback, false); return restAdapter.create(BookmarkInterface.class); }