use of com.instructure.canvasapi.model.DiscussionTopicHeader in project instructure-android by instructure.
the class DiscussionTopicHeaderUnitTest method testLockedDiscussionTopic.
@Test
public void testLockedDiscussionTopic() {
Gson gson = CanvasRestAdapter.getGSONParser();
DiscussionTopicHeader lockedDiscussion = gson.fromJson(lockedDiscussionTopicJSON, DiscussionTopicHeader.class);
// If the DiscussionTopic is locked for the user, make sure the lock_info & explanation aren't empty/null
if (lockedDiscussion.isLockedForUser()) {
assertTrue(!lockedDiscussion.getLockInfo().isEmpty());
assertNotNull(lockedDiscussion.getLockExplanation());
}
LockInfo lockInfo = lockedDiscussion.getLockInfo();
assertNotNull(lockInfo);
// The lock_info should have a context_module
LockedModule lockedModule = lockInfo.getContext_module();
assertNotNull(lockedModule);
assertNotNull(lockedModule.getId());
assertNotNull(lockedModule.getContext_id());
assertNotNull(lockedModule.getContextType());
assertNotNull(lockedModule.getName());
assertNotNull(lockedModule.getUnlock_at());
assertNotNull(lockedModule.isRequireSequentialProgress());
List<ModuleCompletionRequirement> completionRequirements = lockedModule.getCompletionRequirements();
assertNotNull(completionRequirements);
assertEquals(3, completionRequirements.size());
for (ModuleCompletionRequirement requirement : completionRequirements) {
assertNotNull(requirement.getId());
assertNotNull(requirement.getType());
}
}
use of com.instructure.canvasapi.model.DiscussionTopicHeader in project instructure-android by instructure.
the class DiscussionTopicHeaderUnitTest method testDiscussionTopicHeader.
@Test
public void testDiscussionTopicHeader() {
Gson gson = CanvasRestAdapter.getGSONParser();
DiscussionTopicHeader discussionTopicHeader = gson.fromJson(discussionTopicHeaderJSON, DiscussionTopicHeader.class);
assertNotNull(discussionTopicHeader);
assertTrue(discussionTopicHeader.isPinned());
assertTrue(discussionTopicHeader.getStatus() == DiscussionTopicHeader.ReadState.UNREAD);
assertTrue(discussionTopicHeader.getId() > 0);
assertTrue(discussionTopicHeader.getAssignmentId() > 0);
assertNotNull(discussionTopicHeader.getCreator());
assertNotNull(discussionTopicHeader.getHtmlUrl());
assertNotNull(discussionTopicHeader.getLastReply());
assertNotNull(discussionTopicHeader.getMessage());
assertNotNull(discussionTopicHeader.getMessage());
assertNotNull(discussionTopicHeader.getPostedAt());
assertNotNull(discussionTopicHeader.getTitle());
assertTrue(discussionTopicHeader.getType() == DiscussionTopicHeader.DiscussionType.SIDE_COMMENT);
testDiscussionParticipant(discussionTopicHeader.getCreator());
testDiscussionAttachments(discussionTopicHeader.getAttachments());
testDiscussionPermissions(discussionTopicHeader.getPermission());
}
Aggregations