コード例 #1
0
ファイル: TermUnitTest.java プロジェクト: hhoang/CanvasAPI
  @Test
  public void testTerm() {
    Gson gson = CanvasRestAdapter.getGSONParser();
    Term term = gson.fromJson(termJSON, Term.class);

    assertNotNull(term);

    assertNotNull(term.getName());
    assertTrue(term.getId() > 0);
  }
コード例 #2
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);
    }
  }
コード例 #3
0
  @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());
    }
  }
コード例 #4
0
  @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());
    }
  }
コード例 #5
0
ファイル: BookmarkAPI.java プロジェクト: nbutton23/CanvasAPI
 private static BookmarkInterface buildInterface(CanvasCallback<?> callback) {
   RestAdapter restAdapter = CanvasRestAdapter.buildAdapter(callback, false);
   return restAdapter.create(BookmarkInterface.class);
 }