Search in sources :

Example 1 with SubmissionComment

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

the class SubmissionCommentUnitTest method testSubmissionComment.

@Test
public void testSubmissionComment() {
    Gson gson = CanvasRestAdapter.getGSONParser();
    SubmissionComment submissionComment = gson.fromJson(submissionCommentJSON, SubmissionComment.class);
    assertNotNull(submissionComment);
    assertNotNull(submissionComment.getAuthor());
    assertNotNull(submissionComment.getAuthorName());
    assertNotNull(submissionComment.getComment());
    assertNotNull(submissionComment.getCreatedAt());
    assertTrue(submissionComment.getAuthor().getId() > 0);
}
Also used : Gson(com.google.gson.Gson) SubmissionComment(com.instructure.canvasapi.model.SubmissionComment) Test(org.junit.Test)

Example 2 with SubmissionComment

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

the class SubmissionUnitTest method testSubmission.

@Test
public void testSubmission() {
    Gson gson = CanvasRestAdapter.getGSONParser();
    Submission submission = gson.fromJson(submissionJson, Submission.class);
    assertNotNull(submission);
    assertTrue(submission.getId() > 0);
    assertNotNull(submission.getBody());
    assertNotNull(submission.getGrade());
    assertTrue(submission.getScore() > 0);
    assertNotNull(submission.getPreviewUrl());
    assertNotNull(submission.getSubmissionType());
    assertNotNull(submission.getUrl());
    assertNotNull(submission.getWorkflowState());
    assertNotNull(submission.getComments());
    SubmissionComment comment = submission.getComments().get(0);
    isCommentValid(comment);
    assertNotNull(submission.getAttachments());
    Attachment attachment = submission.getAttachments().get(0);
    isValidAttachment(attachment);
}
Also used : Submission(com.instructure.canvasapi.model.Submission) Gson(com.google.gson.Gson) Attachment(com.instructure.canvasapi.model.Attachment) SubmissionComment(com.instructure.canvasapi.model.SubmissionComment) Test(org.junit.Test)

Example 3 with SubmissionComment

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

the class DocumentActivity method onSubmissionCommentsUpdated.

@Override
public void onSubmissionCommentsUpdated(Submission submission) {
    if (mAdapter == null || mViewpager == null) {
        return;
    }
    final ArrayList<SubmissionComment> comments = submission.getComments();
    mSubmissionsList.get(mViewpager.getCurrentItem()).setComments(comments);
    final BaseSubmissionView fragment = (BaseSubmissionView) mAdapter.getItem(mViewpager.getCurrentItem());
    fragment.submission.setComments(comments);
}
Also used : BaseSubmissionView(com.instructure.speedgrader.fragments.BaseSubmissionView) SubmissionComment(com.instructure.canvasapi.model.SubmissionComment)

Aggregations

SubmissionComment (com.instructure.canvasapi.model.SubmissionComment)3 Gson (com.google.gson.Gson)2 Test (org.junit.Test)2 Attachment (com.instructure.canvasapi.model.Attachment)1 Submission (com.instructure.canvasapi.model.Submission)1 BaseSubmissionView (com.instructure.speedgrader.fragments.BaseSubmissionView)1