use of com.instructure.canvasapi.model.LockInfo in project instructure-android by instructure.
the class AssignmentUnitTest method testLockedAssignment.
@Test
public void testLockedAssignment() {
Gson gson = CanvasRestAdapter.getGSONParser();
Assignment lockInfoAssignment = gson.fromJson(lockInfoJSON, Assignment.class);
// If the assignment is locked for the user, make sure the lock_info & explanation aren't empty/null
if (lockInfoAssignment.isLockedForUser()) {
assertTrue(!lockInfoAssignment.getLockInfo().isEmpty());
assertNotNull(lockInfoAssignment.getLock_explanation());
}
LockInfo lockInfo = lockInfoAssignment.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(9, completionRequirements.size());
for (ModuleCompletionRequirement requirement : completionRequirements) {
assertNotNull(requirement.getId());
assertNotNull(requirement.getType());
}
}
use of com.instructure.canvasapi.model.LockInfo 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());
}
}
Aggregations