use of teammates.ui.controller.RedirectResult in project teammates by TEAMMATES.
the class InstructorEditStudentFeedbackSaveActionTest method testClosedSession.
private void testClosedSession() {
______TS("Success case: modifying responses in closed session");
InstructorAttributes instructor = dataBundle.instructors.get("IESFPTCourseinstr");
gaeSimulation.loginAsInstructor(instructor.googleId);
String moderatedStudentEmail = "student1InIESFPTCourse@gmail.tmt";
FeedbackResponsesDb frDb = new FeedbackResponsesDb();
FeedbackQuestionsDb fqDb = new FeedbackQuestionsDb();
FeedbackQuestionAttributes fq = fqDb.getFeedbackQuestion("Closed feedback session", "IESFPTCourse", 1);
FeedbackResponseAttributes fr = dataBundle.feedbackResponses.get("response1ForQ1InClosedSession");
// necessary to get the correct responseId
fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
assertNotNull("Feedback response not found in database", fr);
String[] submissionParams = new String[] { Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1", Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName, Const.ParamsNames.COURSE_ID, fr.courseId, Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId, Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient, Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(), Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "Edited" + fr.getResponseDetails().getAnswerString(), Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderatedStudentEmail };
InstructorEditStudentFeedbackSaveAction a = getAction(submissionParams);
RedirectResult r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_EDIT_STUDENT_FEEDBACK_PAGE, false, "student1InIESFPTCourse%40gmail.tmt", "IESFPTCourseinstr", "IESFPTCourse", "Closed+feedback+session"), r.getDestinationWithParams());
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
}
use of teammates.ui.controller.RedirectResult in project teammates by TEAMMATES.
the class InstructorFeedbackAddActionTest method testExecuteAndPostProcess.
@Override
@Test
public void testExecuteAndPostProcess() {
InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
String expectedString = "";
String teammatesLog = "TEAMMATESLOG|||instructorFeedbackAdd|||instructorFeedbackAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||idOfInstructor1OfCourse1|||" + "instr1@course1.tmt|||";
______TS("Not enough parameters");
gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
verifyAssumptionFailure();
// TODO make sure IFAA does assertNotNull for required parameters then uncomment
// verifyAssumptionFailure(Const.ParamsNames.COURSE_ID, instructor1ofCourse1.courseId);
______TS("Typical case");
String[] params = createParamsCombinationForFeedbackSession(instructor1ofCourse1.courseId, "ifaat tca fs", 0);
InstructorFeedbackAddAction a = getAction(params);
RedirectResult rr = getRedirectResult(a);
expectedString = getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "ifaat+tca+fs", instructor1ofCourse1.googleId, false);
assertEquals(expectedString, rr.getDestinationWithParams());
expectedString = "TEAMMATESLOG|||instructorFeedbackAdd|||instructorFeedbackAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||idOfInstructor1OfCourse1|||" + "instr1@course1.tmt|||New Feedback Session " + "<span class=\"bold\">(ifaat tca fs)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span> created.<br>" + "<span class=\"bold\">From:</span> 2012-01-31T16:00:00Z" + "<span class=\"bold\"> to</span> 2014-12-31T16:00:00Z<br>" + "<span class=\"bold\">Session visible from:</span> 2011-12-31T16:00:00Z<br>" + "<span class=\"bold\">Results visible from:</span> 1970-06-22T00:00:00Z<br>" + "<br><span class=\"bold\">Instructions:</span> " + "<Text: instructions>|||/page/instructorFeedbackAdd";
AssertHelper.assertLogMessageEquals(expectedString, a.getLogMessage());
assertEquals(Const.StatusMessages.FEEDBACK_SESSION_ADDED, rr.getStatusMessage());
______TS("Error: try to add the same session again");
params = createParamsCombinationForFeedbackSession(instructor1ofCourse1.courseId, "ifaat tca fs", 0);
a = getAction(params);
ShowPageResult pr = getShowPageResult(a);
expectedString = getPageResultDestination(Const.ViewURIs.INSTRUCTOR_FEEDBACK_SESSIONS, true, "idOfInstructor1OfCourse1");
assertEquals(expectedString, pr.getDestinationWithParams());
assertTrue(pr.isError);
assertEquals(Const.StatusMessages.FEEDBACK_SESSION_EXISTS, pr.getStatusMessage());
______TS("Error: Invalid parameters (fixed offset time zone and invalid session name, > 38 characters)");
String longFsName = StringHelperExtension.generateStringOfLength(39);
params = createParamsCombinationForFeedbackSession(instructor1ofCourse1.courseId, longFsName, 0);
params[25] = "UTC+08:00";
a = getAction(params);
pr = getShowPageResult(a);
expectedString = getPageResultDestination(Const.ViewURIs.INSTRUCTOR_FEEDBACK_SESSIONS, true, "idOfInstructor1OfCourse1");
assertEquals(expectedString, pr.getDestinationWithParams());
assertTrue(pr.isError);
expectedString = teammatesLog + "Servlet Action Failure : " + "\"" + longFsName + "\" " + "is not acceptable to TEAMMATES as a/an feedback session name because it is too long. " + "The value of a/an feedback session name should be no longer than 38 characters. " + "It should not be empty.<br>" + "\"UTC+08:00\" is not acceptable to TEAMMATES as a/an time zone because it is not " + "available as a choice. The value must be one of the values from the time zone dropdown selector." + "|||/page/instructorFeedbackAdd";
AssertHelper.assertLogMessageEquals(expectedString, a.getLogMessage());
______TS("Error: Overlap publish time with invalid parameters (invalid session name, > 38 characters)");
longFsName = StringHelperExtension.generateStringOfLength(39);
params = createParamsCombinationForFeedbackSession(instructor1ofCourse1.courseId, longFsName, 1);
params[25] = "Asia/Jerusalem";
// After Sun, 25 Oct 2015, 01:59:59 AM: clocks fell back to Sun, 25 Oct 2015, 01:00:00 AM
params[21] = "Sun, 25 Oct, 2015";
params[23] = "1";
a = getAction(params);
pr = getShowPageResult(a);
expectedString = getPageResultDestination(Const.ViewURIs.INSTRUCTOR_FEEDBACK_SESSIONS, true, "idOfInstructor1OfCourse1");
assertEquals(expectedString, pr.getDestinationWithParams());
assertTrue(pr.isError);
String overlapWarning = String.format(Const.StatusMessages.AMBIGUOUS_LOCAL_DATE_TIME_OVERLAP, "time when the results will be visible", "Sun, 25 Oct 2015, 01:00 AM", "Sun, 25 Oct 2015, 01:00 AM IDT (UTC+0300)", "Sun, 25 Oct 2015, 01:00 AM IST (UTC+0200)", "Sun, 25 Oct 2015, 01:00 AM IDT (UTC+0300)");
String lengthError = "\"" + longFsName + "\" " + "is not acceptable to TEAMMATES as a/an feedback session name because it is too long. " + "The value of a/an feedback session name should be no longer than 38 characters. " + "It should not be empty.";
verifyStatusMessage(pr.getStatusToUser().get(0), overlapWarning, StatusMessageColor.WARNING);
verifyStatusMessage(pr.getStatusToUser().get(1), lengthError, StatusMessageColor.DANGER);
expectedString = teammatesLog + "Servlet Action Failure : " + lengthError + "|||/page/instructorFeedbackAdd";
AssertHelper.assertLogMessageEquals(expectedString, a.getLogMessage());
______TS("Add course with extra space (in middle and trailing)");
params = createParamsCombinationForFeedbackSession(instructor1ofCourse1.courseId, "Course with extra space ", 1);
a = getAction(params);
rr = getRedirectResult(a);
expectedString = getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "Course+with+extra+space", instructor1ofCourse1.googleId, false);
assertEquals(expectedString, rr.getDestinationWithParams());
expectedString = "TEAMMATESLOG|||instructorFeedbackAdd|||instructorFeedbackAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||idOfInstructor1OfCourse1|||" + "instr1@course1.tmt|||New Feedback Session " + "<span class=\"bold\">(Course with extra space)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span> created.<br>" + "<span class=\"bold\">From:</span> 2012-01-31T16:00:00Z" + "<span class=\"bold\"> to</span> 2014-12-31T16:00:00Z<br>" + "<span class=\"bold\">Session visible from:</span> 1970-12-31T00:00:00Z<br>" + "<span class=\"bold\">Results visible from:</span> 2014-05-07T18:00:00Z<br><br>" + "<span class=\"bold\">Instructions:</span> " + "<Text: instructions>|||/page/instructorFeedbackAdd";
AssertHelper.assertLogMessageEquals(expectedString, a.getLogMessage());
assertEquals(Const.StatusMessages.FEEDBACK_SESSION_ADDED, rr.getStatusMessage());
______TS("DST time zone, gap end time");
params = createParamsForTypicalFeedbackSession(instructor1ofCourse1.courseId, "Course with DST time zone");
params[25] = "Asia/Jerusalem";
// After Fri, 28 Mar 2014, 01:59:59 AM: clocks sprang forward to Fri, 28 Mar 2014, 03:00:00 AM
params[9] = "Fri, 28 Mar, 2014";
params[11] = "2";
a = getAction(params);
rr = getRedirectResult(a);
expectedString = getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "Course+with+DST+time+zone", instructor1ofCourse1.googleId, false);
assertEquals(expectedString, rr.getDestinationWithParams());
expectedString = "TEAMMATESLOG|||instructorFeedbackAdd|||instructorFeedbackAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||idOfInstructor1OfCourse1|||" + "instr1@course1.tmt|||New Feedback Session " + "<span class=\"bold\">(Course with DST time zone)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span> created.<br>" + "<span class=\"bold\">From:</span> 2012-01-31T22:00:00Z" + "<span class=\"bold\"> to</span> 2014-03-28T00:00:00Z<br>" + "<span class=\"bold\">Session visible from:</span> 2011-12-31T22:00:00Z<br>" + "<span class=\"bold\">Results visible from:</span> 1970-06-22T00:00:00Z<br><br>" + "<span class=\"bold\">Instructions:</span> " + "<Text: instructions>|||" + "/page/instructorFeedbackAdd";
AssertHelper.assertLogMessageEquals(expectedString, a.getLogMessage());
expectedString = String.format(Const.StatusMessages.AMBIGUOUS_LOCAL_DATE_TIME_GAP, "end time", "Fri, 28 Mar 2014, 02:00 AM", "Fri, 28 Mar 2014, 03:00 AM IDT (UTC+0300)") + "<br>" + Const.StatusMessages.FEEDBACK_SESSION_ADDED;
assertEquals(expectedString, rr.getStatusMessage());
______TS("Masquerade mode");
String adminUserId = "admin.user";
gaeSimulation.loginAsAdmin(adminUserId);
params = createParamsCombinationForFeedbackSession(instructor1ofCourse1.courseId, "masquerade session", 3);
params = addUserIdToParams(instructor1ofCourse1.googleId, params);
a = getAction(params);
rr = getRedirectResult(a);
expectedString = getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "masquerade+session", instructor1ofCourse1.googleId, false);
assertEquals(expectedString, rr.getDestinationWithParams());
expectedString = "TEAMMATESLOG|||instructorFeedbackAdd|||instructorFeedbackAdd|||true|||" + "Instructor(M)|||Instructor 1 of Course 1|||idOfInstructor1OfCourse1|||" + "instr1@course1.tmt|||New Feedback Session " + "<span class=\"bold\">(masquerade session)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span> created.<br>" + "<span class=\"bold\">From:</span> 2012-01-31T16:00:00Z" + "<span class=\"bold\"> to</span> 2014-12-31T16:00:00Z<br>" + "<span class=\"bold\">Session visible from:</span> 2011-12-31T16:00:00Z<br>" + "<span class=\"bold\">Results visible from:</span> 1970-01-01T00:00:00Z<br><br>" + "<span class=\"bold\">Instructions:</span> " + "<Text: >|||/page/instructorFeedbackAdd";
AssertHelper.assertLogMessageEqualsInMasqueradeMode(expectedString, a.getLogMessage(), adminUserId);
assertEquals(Const.StatusMessages.FEEDBACK_SESSION_ADDED, rr.getStatusMessage());
______TS("Unsuccessful case: test null time zone parameter");
params = ArrayUtils.remove(params, 26);
params = ArrayUtils.remove(params, 26);
try {
a = getAction(params);
getRedirectResult(a);
} catch (NullPostParameterException e) {
assertEquals(String.format(Const.StatusCodes.NULL_POST_PARAMETER, Const.ParamsNames.FEEDBACK_SESSION_TIMEZONE), e.getMessage());
}
______TS("Unsuccessful case: test null course ID parameter");
params = new String[] {};
try {
a = getAction(params);
getRedirectResult(a);
} catch (NullPostParameterException e) {
assertEquals(String.format(Const.StatusCodes.NULL_POST_PARAMETER, Const.ParamsNames.COURSE_ID), e.getMessage());
}
// remove the sessions that were added
FeedbackSessionsLogic.inst().deleteFeedbackSessionsForCourseCascade(instructor1ofCourse1.courseId);
}
use of teammates.ui.controller.RedirectResult in project teammates by TEAMMATES.
the class InstructorFeedbackCopyActionTest method testExecuteAndPostProcess.
@Override
@Test
public void testExecuteAndPostProcess() throws Exception {
// TODO: find a way to test status message from session
InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
String expectedString = "";
String teammatesLogMessage = "TEAMMATESLOG|||instructorFeedbackCopy|||instructorFeedbackCopy|||true|||Instructor|||" + "Instructor 1 of Course 1|||idOfInstructor1OfCourse1|||instr1@course1.tmt|||";
______TS("Not enough parameters");
gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
verifyAssumptionFailure();
// TODO make sure IFAA does assertNotNull for required parameters then uncomment
// verifyAssumptionFailure(Const.ParamsNames.COURSE_ID, instructor1ofCourse1.courseId);
______TS("Typical case");
String[] params = new String[] { Const.ParamsNames.COPIED_FEEDBACK_SESSION_NAME, "Copied Session", Const.ParamsNames.COPIED_COURSE_ID, "idOfTypicalCourse1", Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session", Const.ParamsNames.COURSE_ID, "idOfTypicalCourse1" };
InstructorFeedbackCopyAction a = getAction(params);
RedirectResult rr = getRedirectResult(a);
expectedString = getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "Copied+Session", instructor1ofCourse1.googleId, false);
assertEquals(expectedString, rr.getDestinationWithParams());
expectedString = "TEAMMATESLOG|||instructorFeedbackCopy|||instructorFeedbackCopy|||true|||" + "Instructor|||Instructor 1 of Course 1|||idOfInstructor1OfCourse1|||" + "instr1@course1.tmt|||New Feedback Session " + "<span class=\"bold\">(Copied Session)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span> created.<br>" + "<span class=\"bold\">From:</span> 2012-04-01T21:59:00Z" + "<span class=\"bold\"> to</span> 2027-04-30T21:59:00Z<br>" + "<span class=\"bold\">Session visible from:</span> 2012-03-28T21:59:00Z<br>" + "<span class=\"bold\">Results visible from:</span> 2027-05-01T21:59:00Z<br><br>" + "<span class=\"bold\">Instructions:</span> " + "<Text: Please please fill in the following questions.>|||/page/instructorFeedbackCopy";
AssertHelper.assertLogMessageEquals(expectedString, a.getLogMessage());
______TS("Error: Trying to copy with existing feedback session name");
params = new String[] { Const.ParamsNames.COPIED_FEEDBACK_SESSION_NAME, "Second feedback session", Const.ParamsNames.COPIED_COURSE_ID, "idOfTypicalCourse1", Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session", Const.ParamsNames.COURSE_ID, "idOfTypicalCourse1" };
a = getAction(params);
RedirectResult pageResult = getRedirectResult(a);
assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE).withParam(Const.ParamsNames.ERROR, Boolean.TRUE.toString()).withParam(Const.ParamsNames.USER_ID, instructor1ofCourse1.googleId).toString(), pageResult.getDestinationWithParams());
assertTrue(pageResult.isError);
assertEquals(Const.StatusMessages.FEEDBACK_SESSION_EXISTS, pageResult.getStatusMessage());
expectedString = "TEAMMATESLOG|||instructorFeedbackCopy|||instructorFeedbackCopy|||true|||" + "Instructor|||Instructor 1 of Course 1|||idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "Servlet Action Failure : Trying to create a Feedback Session that exists: " + "Second feedback session/idOfTypicalCourse1|||" + "/page/instructorFeedbackCopy";
AssertHelper.assertLogMessageEquals(expectedString, a.getLogMessage());
______TS("Error: Trying to copy with invalid feedback session name");
params = new String[] { Const.ParamsNames.COPIED_FEEDBACK_SESSION_NAME, "", Const.ParamsNames.COPIED_COURSE_ID, "idOfTypicalCourse1", Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session", Const.ParamsNames.COURSE_ID, "idOfTypicalCourse1" };
a = getAction(params);
pageResult = getRedirectResult(a);
assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE).withParam(Const.ParamsNames.ERROR, Boolean.TRUE.toString()).withParam(Const.ParamsNames.USER_ID, instructor1ofCourse1.googleId).toString(), pageResult.getDestinationWithParams());
assertTrue(pageResult.isError);
assertEquals(getPopulatedEmptyStringErrorMessage(FieldValidator.SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE_EMPTY_STRING, FieldValidator.FEEDBACK_SESSION_NAME_FIELD_NAME, FieldValidator.FEEDBACK_SESSION_NAME_MAX_LENGTH), pageResult.getStatusMessage());
expectedString = teammatesLogMessage + "Servlet Action Failure : " + "The field 'feedback session name' is empty. " + "The value of a/an feedback session name should be no longer than 38 characters. " + "It should not be empty.|||/page/instructorFeedbackCopy";
AssertHelper.assertLogMessageEquals(expectedString, a.getLogMessage());
______TS("Masquerade mode");
String adminUserId = "admin.user";
gaeSimulation.loginAsAdmin(adminUserId);
params = new String[] { Const.ParamsNames.COPIED_FEEDBACK_SESSION_NAME, "Second copied feedback session", Const.ParamsNames.COPIED_COURSE_ID, "idOfTypicalCourse1", Const.ParamsNames.FEEDBACK_SESSION_NAME, "Second feedback session", Const.ParamsNames.COURSE_ID, "idOfTypicalCourse1" };
params = addUserIdToParams(instructor1ofCourse1.googleId, params);
a = getAction(params);
rr = getRedirectResult(a);
expectedString = getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "Second+copied+feedback+session", instructor1ofCourse1.googleId, false);
assertEquals(expectedString, rr.getDestinationWithParams());
expectedString = "TEAMMATESLOG|||instructorFeedbackCopy|||instructorFeedbackCopy|||true|||" + "Instructor(M)|||Instructor 1 of Course 1|||idOfInstructor1OfCourse1|||" + "instr1@course1.tmt|||New Feedback Session " + "<span class=\"bold\">(Second copied feedback session)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span> created.<br>" + "<span class=\"bold\">From:</span> 2013-06-01T21:59:00Z" + "<span class=\"bold\"> to</span> 2026-04-28T21:59:00Z<br>" + "<span class=\"bold\">Session visible from:</span> 2013-03-20T21:59:00Z<br>" + "<span class=\"bold\">Results visible from:</span> 2026-04-29T21:59:00Z<br><br>" + "<span class=\"bold\">Instructions:</span> " + "<Text: Please please fill in the following questions.>|||/page/instructorFeedbackCopy";
AssertHelper.assertLogMessageEqualsInMasqueradeMode(expectedString, a.getLogMessage(), adminUserId);
}
use of teammates.ui.controller.RedirectResult in project teammates by TEAMMATES.
the class InstructorFeedbackQuestionAddActionTest method testExecuteAndPostProcessConstSumRecipient.
@Test
public void testExecuteAndPostProcessConstSumRecipient() {
InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
______TS("Typical case");
FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
String[] params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, FeedbackParticipantType.STUDENTS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, FeedbackParticipantType.STUDENTS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, "1", Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "CONSTSUM", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "Split points among students.", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTS, "30", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSFOREACHOPTION, "50", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSFOREACHRECIPIENT, "100", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSPEROPTION, "true", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMTORECIPIENTS, "true", // default value.
Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, // default value.
"2", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "custom", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIES, "2", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.RECEIVER.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.RECEIVER.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.RECEIVER.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit" };
InstructorFeedbackQuestionAddAction action = getAction(params);
RedirectResult result = getRedirectResult(action);
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "First+feedback+session", instructor1ofCourse1.googleId, false), result.getDestinationWithParams());
assertEquals(Const.StatusMessages.FEEDBACK_QUESTION_ADDED, result.getStatusMessage());
String expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackQuestionAdd|||" + "instructorFeedbackQuestionAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||" + "idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "Created Feedback Question for Feedback Session:<span class=\"bold\">" + "(First feedback session)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span>" + " created.<br><span class=\"bold\">Distribute points " + "(among recipients) question:</span> Split points among students." + "|||/page/instructorFeedbackQuestionAdd";
AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
}
use of teammates.ui.controller.RedirectResult in project teammates by TEAMMATES.
the class InstructorFeedbackQuestionAddActionTest method testExecuteAndPostProcessRubricQuestion.
@Test
public void testExecuteAndPostProcessRubricQuestion() {
InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
______TS("Typical case");
// tests when descriptions are missing as well.
FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
String[] params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, FeedbackParticipantType.STUDENTS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, "1", Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "RUBRIC", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "Please choose the most appropriate choices for the sub-questions below.", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_COLS, "2", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_ROWS, "2", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_SUBQUESTION + "-0", "SubQn-1", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_CHOICE + "-0", "Choice-1", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_WEIGHT + "-0", "-1", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_SUBQUESTION + "-1", "SubQn-2", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_CHOICE + "-1", "Choice-2", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_WEIGHT + "-1", "2", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIES, "1", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit" };
InstructorFeedbackQuestionAddAction action = getAction(params);
RedirectResult result = getRedirectResult(action);
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "First+feedback+session", instructor1ofCourse1.googleId, false), result.getDestinationWithParams());
String expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackQuestionAdd|||" + "instructorFeedbackQuestionAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||" + "idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "Created Feedback Question for Feedback Session:<span class=\"bold\">" + "(First feedback session)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span>" + " created.<br><span class=\"bold\">Rubric question:</span> " + "Please choose the most appropriate choices for the sub-questions below." + "|||/page/instructorFeedbackQuestionAdd";
AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
}
Aggregations