use of com.instructure.canvasapi2.models.Assignment.submissionTypeToAPIString in project instructure-android by instructure.
the class AssignmentUtils2Test method getAssignmentState_stateInClass.
@Test
public void getAssignmentState_stateInClass() throws Exception {
Assignment assignment = new Assignment();
Submission submission = null;
long time = Calendar.getInstance().getTimeInMillis() + 100000;
Date date = new Date(time);
ArrayList<String> submissionTypes = new ArrayList<>();
submissionTypes.add(Assignment.submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ON_PAPER));
assignment.setSubmission(submission);
assignment.setDueAt(APIHelper.dateToString(date));
assignment.setSubmissionTypes(submissionTypes);
int testValue = AssignmentUtils2.getAssignmentState(assignment, submission);
assertEquals("", testValue, AssignmentUtils2.ASSIGNMENT_STATE_IN_CLASS);
}
use of com.instructure.canvasapi2.models.Assignment.submissionTypeToAPIString in project instructure-android by instructure.
the class AssignmentTest method isAllowedToSubmit_TestFalse.
@Test
public void isAllowedToSubmit_TestFalse() {
Assignment assignment = new Assignment();
List<String> submissionTypeList = new ArrayList<>();
submissionTypeList.add(Assignment.submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ATTENDANCE));
submissionTypeList.add(Assignment.submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ONLINE_QUIZ));
assignment.setSubmissionTypes(submissionTypeList);
assignment.setLockedForUser(true);
assertEquals(false, assignment.isAllowedToSubmit());
}
use of com.instructure.canvasapi2.models.Assignment.submissionTypeToAPIString in project instructure-android by instructure.
the class AssignmentTest method isAllowedToSubmit_TestTrue.
@Test
public void isAllowedToSubmit_TestTrue() {
Assignment assignment = new Assignment();
List<String> submissionTypeList = new ArrayList<>();
submissionTypeList.add(Assignment.submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.DISCUSSION_TOPIC));
submissionTypeList.add(Assignment.submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ONLINE_URL));
assignment.setSubmissionTypes(submissionTypeList);
assignment.setLockedForUser(false);
assertEquals(true, assignment.isAllowedToSubmit());
}
Aggregations