Search in sources :

Example 1 with FeedbackConstantSumResponseDetails

use of teammates.common.datatransfer.questions.FeedbackConstantSumResponseDetails in project teammates by TEAMMATES.

the class StudentFeedbackSubmitPageUiTest method testSubmitAction.

private void testSubmitAction() throws Exception {
    ______TS("create new responses");
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    submitPage.waitForPageToLoad();
    String responseText = "Test Self Feedback";
    submitPage.fillResponseRichTextEditor(1, 0, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(1, 0));
    responseText = "Response to Benny.";
    submitPage.selectRecipient(2, 0, "Benny Charles");
    submitPage.fillResponseRichTextEditor(2, 0, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(2, 0));
    responseText = "Response to student who is going to drop out.";
    submitPage.selectRecipient(2, 1, "Drop out");
    submitPage.fillResponseRichTextEditor(2, 1, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(2, 1));
    responseText = "Response to extra guy.";
    submitPage.selectRecipient(2, 2, "Extra guy");
    submitPage.fillResponseRichTextEditor(2, 2, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(2, 2));
    submitPage.fillResponseTextBox(14, 0, "1");
    // Test partial response for question
    responseText = "Feedback to team 3";
    submitPage.fillResponseRichTextEditor(4, 1, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(4, 1));
    submitPage.verifyOtherOptionTextUnclickable(6, 0);
    submitPage.chooseMcqOption(6, 0, "");
    submitPage.waitForOtherOptionTextToBeClickable(6, 0);
    submitPage.fillMcqOtherOptionTextBox(6, 0, "Features");
    submitPage.chooseMcqOption(7, 0, "Algo");
    submitPage.verifyOtherOptionTextUnclickable(8, 0);
    submitPage.toggleMsqOption(8, 0, "");
    submitPage.waitForOtherOptionTextToBeClickable(8, 0);
    submitPage.fillMsqOtherOptionTextBox(8, 0, "Features");
    submitPage.toggleMsqOption(9, 0, "UI");
    submitPage.toggleMsqOption(9, 0, "Design");
    submitPage.fillResponseTextBox(18, 0, 0, "90");
    submitPage.fillResponseTextBox(18, 0, 1, "10");
    // total sums up to expected value, verify empty entries are filled with 0
    submitPage.fillResponseTextBox(19, 1, 0, "200");
    assertEquals(submitPage.getResponseTextBoxValue(19, 0, 0), "0");
    // delete an auto-filled 0, verify it's auto-filled again
    submitPage.clearResponseTextBoxValue(19, 0, 0);
    assertEquals(submitPage.getResponseTextBoxValue(19, 0, 0), "0");
    // modify a non-zero value and remove a 0
    submitPage.fillResponseTextBox(19, 1, 0, "100");
    submitPage.clearResponseTextBoxValue(19, 0, 0);
    // verify no longer auto-filled with 0
    assertTrue(submitPage.isTextBoxValueEmpty(19, 0, 0));
    // clear both input box for successful form submission.
    submitPage.clearResponseTextBoxValue(19, 1, 0);
    submitPage.chooseContribOption(20, 0, "Equal share");
    // Just check that some of the responses persisted.
    FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 2);
    FeedbackQuestionAttributes fqPartial = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 4);
    FeedbackQuestionAttributes fqMcq = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 8);
    FeedbackQuestionAttributes fqMsq = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 10);
    FeedbackQuestionAttributes fqNumscale = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 15);
    FeedbackQuestionAttributes fqConstSum = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 19);
    FeedbackQuestionAttributes fqConstSum2 = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 20);
    FeedbackQuestionAttributes fqContrib = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 21);
    assertNull(BackDoor.getFeedbackResponse(fq.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.benny.c@gmail.tmt"));
    String aliceTeam = testData.students.get("Alice").team;
    assertNull(BackDoor.getFeedbackResponse(fqPartial.getId(), aliceTeam, "Team 3"));
    assertNull(BackDoor.getFeedbackResponse(fqMcq.getId(), aliceTeam, "Team 2"));
    assertNull(BackDoor.getFeedbackResponse(fqMsq.getId(), aliceTeam, "Team 2"));
    assertNull(BackDoor.getFeedbackResponse(fqNumscale.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqConstSum.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqContrib.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqContrib.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.benny.c@gmail.tmt"));
    submitPage.submitWithoutConfirmationEmail();
    submitPage.verifyAndCloseSuccessfulSubmissionModal();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    assertNotNull(BackDoor.getFeedbackResponse(fq.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.benny.c@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fqPartial.getId(), aliceTeam, "Team 3"));
    assertNotNull(BackDoor.getFeedbackResponse(fqMcq.getId(), aliceTeam, "Team 2"));
    assertNotNull(BackDoor.getFeedbackResponse(fqMsq.getId(), aliceTeam, "Team 2"));
    assertNotNull(BackDoor.getFeedbackResponse(fqNumscale.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fqConstSum.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fqContrib.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqContrib.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.benny.c@gmail.tmt"));
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    submitPage.verifyHtmlMainContent("/studentFeedbackSubmitPagePartiallyFilled.html");
    ______TS("test toggle radio button");
    submitPage.chooseMcqOption(7, 1, "UI");
    submitPage.chooseMcqOption(7, 1, "Algo");
    // toggle 'Algo' radio option
    submitPage.chooseMcqOption(7, 1, "Algo");
    submitPage.submitWithoutConfirmationEmail();
    submitPage.verifyAndCloseSuccessfulSubmissionModal();
    assertNull(BackDoor.getFeedbackResponse(fqMcq.getId(), aliceTeam, "Team 3"));
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    submitPage.verifyHtmlMainContent("/studentFeedbackSubmitPagePartiallyFilled.html");
    ______TS("edit existing response");
    // Test editing an existing response
    // + fill up rest of responses at the same time
    String editedResponse = "Edited response to Benny.";
    submitPage.fillResponseRichTextEditor(2, 0, editedResponse);
    assertEquals(editedResponse.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(2, 0));
    responseText = "Feedback to instructors";
    submitPage.fillResponseRichTextEditor(3, 0, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(3, 0));
    responseText = "Feedback to team 2.";
    submitPage.fillResponseRichTextEditor(4, 1, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(4, 1));
    responseText = "Feedback to teammate.";
    submitPage.fillResponseRichTextEditor(5, 0, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(5, 0));
    submitPage.chooseMcqOption(6, 0, "UI");
    // Changed from "Algo" to "UI"
    submitPage.chooseMcqOption(7, 0, "UI");
    submitPage.chooseMcqOption(7, 1, "UI");
    submitPage.toggleMsqOption(8, 0, "UI");
    submitPage.toggleMsqOption(8, 0, "Algo");
    submitPage.toggleMsqOption(8, 0, "Design");
    submitPage.toggleMsqOption(9, 0, "UI");
    submitPage.toggleMsqOption(9, 0, "Algo");
    submitPage.toggleMsqOption(9, 0, "Design");
    submitPage.toggleMsqOption(9, 1, "Design");
    submitPage.chooseMcqOption(10, 0, "Drop out (Team 2)");
    submitPage.toggleMsqOption(11, 0, "Alice Betsy</option></td></div>'\" (Team >'\"< 1</td></div>'\")");
    submitPage.toggleMsqOption(11, 0, "Benny Charles (Team >'\"< 1</td></div>'\")");
    submitPage.toggleMsqOption(11, 0, "Charlie Davis (Team 2)");
    submitPage.toggleMsqOption(11, 0, "Extra guy (Team 2)");
    submitPage.chooseMcqOption(12, 0, "Team 2");
    submitPage.toggleMsqOption(13, 0, "Team >'\"< 1</td></div>'\"");
    submitPage.toggleMsqOption(13, 0, "Team 3");
    submitPage.fillResponseTextBox(14, 0, "5");
    submitPage.fillResponseTextBox(15, 0, "1.5");
    submitPage.fillResponseTextBox(15, 1, "2.5");
    submitPage.chooseMcqOption(16, 0, "Teammates Test2");
    submitPage.toggleMsqOption(17, 0, "Teammates Test");
    submitPage.toggleMsqOption(17, 0, "Teammates Test3");
    submitPage.fillResponseTextBox(18, 0, 0, "70");
    submitPage.fillResponseTextBox(18, 0, 1, "30");
    submitPage.fillResponseTextBox(19, 0, 0, "90");
    submitPage.fillResponseTextBox(19, 1, 0, "110");
    submitPage.chooseContribOption(20, 1, "0%");
    // Just check the edited responses, and two new response.
    assertNull(BackDoor.getFeedbackResponse(fqPartial.getId(), aliceTeam, "Team 2"));
    assertNull(BackDoor.getFeedbackResponse(fqConstSum2.getId(), aliceTeam, "Team 2"));
    assertNull(BackDoor.getFeedbackResponse(fqConstSum2.getId(), aliceTeam, "Team 3"));
    submitPage.submitWithoutConfirmationEmail();
    // check new response
    fqPartial = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 4);
    assertNotNull(BackDoor.getFeedbackResponse(fqPartial.getId(), aliceTeam, "Team 2"));
    // check edited
    submitPage.verifyAndCloseSuccessfulSubmissionModal();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    assertEquals("<p>" + editedResponse + "</p>", BackDoor.getFeedbackResponse(fq.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.benny.c@gmail.tmt").responseMetaData.getValue());
    assertEquals("UI", BackDoor.getFeedbackResponse(fqMcq.getId(), aliceTeam, "Team 2").getResponseDetails().getAnswerString());
    FeedbackMsqResponseDetails frMsq = (FeedbackMsqResponseDetails) BackDoor.getFeedbackResponse(fqMsq.getId(), aliceTeam, "Team 2").getResponseDetails();
    assertFalse(frMsq.contains("UI"));
    assertTrue(frMsq.contains("Algo"));
    assertFalse(frMsq.contains("Design"));
    FeedbackNumericalScaleResponseDetails frNumscale = (FeedbackNumericalScaleResponseDetails) BackDoor.getFeedbackResponse(fqNumscale.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt").getResponseDetails();
    assertEquals("5", frNumscale.getAnswerString());
    FeedbackConstantSumResponseDetails frConstSum = (FeedbackConstantSumResponseDetails) BackDoor.getFeedbackResponse(fqConstSum.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt").getResponseDetails();
    assertEquals("70, 30", frConstSum.getAnswerString());
    FeedbackConstantSumResponseDetails frConstSum1 = (FeedbackConstantSumResponseDetails) BackDoor.getFeedbackResponse(fqConstSum2.getId(), aliceTeam, "Team 2").getResponseDetails();
    assertEquals("90", frConstSum1.getAnswerString());
    FeedbackConstantSumResponseDetails frConstSum2 = (FeedbackConstantSumResponseDetails) BackDoor.getFeedbackResponse(fqConstSum2.getId(), aliceTeam, "Team 3").getResponseDetails();
    assertEquals("110", frConstSum2.getAnswerString());
    FeedbackContributionResponseDetails frContrib = (FeedbackContributionResponseDetails) BackDoor.getFeedbackResponse(fqContrib.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt").getResponseDetails();
    assertEquals("100", frContrib.getAnswerString());
    FeedbackContributionResponseDetails frContrib1 = (FeedbackContributionResponseDetails) BackDoor.getFeedbackResponse(fqContrib.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.benny.c@gmail.tmt").getResponseDetails();
    assertEquals("0", frContrib1.getAnswerString());
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    submitPage.verifyHtmlMainContent("/studentFeedbackSubmitPageFullyFilled.html");
    ______TS("MSQ: min/max selectable choices test");
    int qnNumber = 22;
    // Submit response with 1 option checked
    submitPage.toggleMsqOption(qnNumber, 0, "Charlie Davis (Team 2)");
    submitPage.clickSubmitButton();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(String.format(Const.StatusMessages.FEEDBACK_RESPONSES_MSQ_MIN_CHECK, qnNumber, 2));
    // Submit response with 2 options checked
    submitPage.toggleMsqOption(qnNumber, 0, "Drop out (Team 2)");
    submitPage.clickSubmitButton();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    submitPage.waitForConfirmationModalAndClickOk();
    // Submit response with 3 options checked
    submitPage.toggleMsqOption(qnNumber, 0, "Emily (Team 3)");
    submitPage.clickSubmitButton();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    submitPage.waitForConfirmationModalAndClickOk();
    // Submit response with 4 options checked
    submitPage.toggleMsqOption(qnNumber, 0, "Extra guy (Team 2)");
    submitPage.clickSubmitButton();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(String.format(Const.StatusMessages.FEEDBACK_RESPONSES_MSQ_MAX_CHECK, qnNumber, 3));
    // Uncheck an option so that response is valid
    submitPage.toggleMsqOption(qnNumber, 0, "Extra guy (Team 2)");
    qnNumber = 23;
    // Submit response for 1st recipient with 2 options checked
    submitPage.toggleMsqOption(qnNumber, 0, "B");
    submitPage.toggleMsqOption(qnNumber, 0, "C");
    submitPage.clickSubmitButton();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(String.format(Const.StatusMessages.FEEDBACK_RESPONSES_MSQ_MIN_CHECK, qnNumber, 3));
    // Submit response for 1st recipient with 3 options checked
    submitPage.toggleMsqOption(qnNumber, 0, "E");
    submitPage.clickSubmitButton();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    submitPage.waitForConfirmationModalAndClickOk();
    // Submit response for 1st recipient with 4 options checked
    submitPage.toggleMsqOption(qnNumber, 0, "A");
    submitPage.clickSubmitButton();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(String.format(Const.StatusMessages.FEEDBACK_RESPONSES_MSQ_MAX_CHECK, qnNumber, 3));
    ______TS("create new response for unreg student");
    submitPage.logout();
    submitPage = loginToStudentFeedbackSubmitPage(testData.students.get("DropOut"), "Open Session");
    responseText = "Test Self Feedback";
    submitPage.fillResponseRichTextEditor(1, 0, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(1, 0));
    responseText = "Response to Benny.";
    submitPage.selectRecipient(2, 0, "Benny Charles");
    submitPage.fillResponseRichTextEditor(2, 0, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(2, 0));
    responseText = "Response to student who is number 1.";
    submitPage.selectRecipient(2, 1, "Alice Betsy</option></td></div>'\"");
    submitPage.fillResponseRichTextEditor(2, 1, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(2, 1));
    responseText = "Response to extra guy.";
    submitPage.selectRecipient(2, 2, "Extra guy");
    submitPage.fillResponseRichTextEditor(2, 2, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(2, 2));
    submitPage.fillResponseTextBox(14, 0, "1");
    // Test partial response for question
    responseText = "Feedback to team 3";
    submitPage.fillResponseRichTextEditor(4, 0, responseText);
    assertEquals(responseText.trim().split(" +").length, submitPage.getResponseTextBoxLengthLabelValue(4, 0));
    submitPage.chooseMcqOption(7, 1, "Algo");
    submitPage.toggleMsqOption(9, 1, "UI");
    submitPage.toggleMsqOption(9, 1, "Design");
    submitPage.fillResponseTextBox(18, 0, 0, "90");
    submitPage.fillResponseTextBox(18, 0, 1, "10");
    submitPage.chooseContribOption(20, 0, "Equal share");
    assertNull(BackDoor.getFeedbackResponse(fq.getId(), "drop.out@gmail.tmt", "SFSubmitUiT.benny.c@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqPartial.getId(), "Team 2", "Team 3"));
    assertNull(BackDoor.getFeedbackResponse(fqMcq.getId(), "Team 2", testData.students.get("Alice").team));
    assertNull(BackDoor.getFeedbackResponse(fqMsq.getId(), "Team 2", testData.students.get("Alice").team));
    assertNull(BackDoor.getFeedbackResponse(fqNumscale.getId(), "drop.out@gmail.tmt", "drop.out@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqConstSum.getId(), "drop.out@gmail.tmt", "drop.out@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqContrib.getId(), "drop.out@gmail.tmt", "SFSubmitUiT.charlie.d@gmail.tmt"));
    submitPage.submitWithoutConfirmationEmail();
    submitPage.verifyAndCloseSuccessfulSubmissionModal();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    submitPage.verifyHtmlMainContent("/unregisteredStudentFeedbackSubmitPagePartiallyFilled.html");
    assertNotNull(BackDoor.getFeedbackResponse(fq.getId(), "drop.out@gmail.tmt", "SFSubmitUiT.benny.c@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fqPartial.getId(), "Team 2", "Team 3"));
    assertNotNull(BackDoor.getFeedbackResponse(fqMcq.getId(), "Team 2", testData.students.get("Alice").team));
    assertNotNull(BackDoor.getFeedbackResponse(fqMsq.getId(), "Team 2", testData.students.get("Alice").team));
    assertNotNull(BackDoor.getFeedbackResponse(fqNumscale.getId(), "drop.out@gmail.tmt", "drop.out@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fqConstSum.getId(), "drop.out@gmail.tmt", "drop.out@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fqContrib.getId(), "drop.out@gmail.tmt", "SFSubmitUiT.charlie.d@gmail.tmt"));
}
Also used : FeedbackMsqResponseDetails(teammates.common.datatransfer.questions.FeedbackMsqResponseDetails) FeedbackNumericalScaleResponseDetails(teammates.common.datatransfer.questions.FeedbackNumericalScaleResponseDetails) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) FeedbackContributionResponseDetails(teammates.common.datatransfer.questions.FeedbackContributionResponseDetails) FeedbackConstantSumResponseDetails(teammates.common.datatransfer.questions.FeedbackConstantSumResponseDetails)

Example 2 with FeedbackConstantSumResponseDetails

use of teammates.common.datatransfer.questions.FeedbackConstantSumResponseDetails in project teammates by TEAMMATES.

the class InstructorFeedbackSubmitPageUiTest method testSubmitAction.

private void testSubmitAction() throws Exception {
    ______TS("create new responses");
    submitPage = loginToInstructorFeedbackSubmitPage("IFSubmitUiT.instr", "Open Session");
    submitPage.fillResponseRichTextEditor(1, 0, "Test Self Feedback");
    submitPage.selectRecipient(2, 0, "Alice Betsy</option></td></div>'\"");
    submitPage.fillResponseRichTextEditor(2, 0, "Response to Alice.");
    submitPage.selectRecipient(2, 1, "Drop out");
    submitPage.fillResponseRichTextEditor(2, 1, "Response to student who is going to drop out.");
    submitPage.selectRecipient(2, 2, "Extra guy");
    submitPage.fillResponseRichTextEditor(2, 2, "Response to extra guy.");
    submitPage.fillResponseTextBox(13, 0, "1");
    // Test partial response for question
    submitPage.fillResponseRichTextEditor(4, 1, "Feedback to Instructor 3");
    submitPage.selectRecipient(6, 0, "Teammates Test2");
    submitPage.chooseMcqOption(6, 0, "Algo");
    submitPage.selectRecipient(8, 0, "Teammates Test2");
    submitPage.toggleMsqOption(8, 0, "UI");
    submitPage.toggleMsqOption(8, 0, "Design");
    submitPage.fillResponseTextBox(17, 0, 0, "90");
    submitPage.fillResponseTextBox(17, 0, 1, "10");
    // Just check that some of the responses persisted.
    FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IFSubmitUiT.CS2104", "First Session", 2);
    FeedbackQuestionAttributes fqPartial = BackDoor.getFeedbackQuestion("IFSubmitUiT.CS2104", "First Session", 6);
    FeedbackQuestionAttributes fqMcq = BackDoor.getFeedbackQuestion("IFSubmitUiT.CS2104", "First Session", 8);
    FeedbackQuestionAttributes fqMsq = BackDoor.getFeedbackQuestion("IFSubmitUiT.CS2104", "First Session", 10);
    FeedbackQuestionAttributes fqNumscale = BackDoor.getFeedbackQuestion("IFSubmitUiT.CS2104", "First Session", 15);
    FeedbackQuestionAttributes fqConstSum = BackDoor.getFeedbackQuestion("IFSubmitUiT.CS2104", "First Session", 19);
    FeedbackQuestionAttributes fqConstSum2 = BackDoor.getFeedbackQuestion("IFSubmitUiT.CS2104", "First Session", 20);
    assertNull(BackDoor.getFeedbackResponse(fq.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.alice.b@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqPartial.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr2@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqMcq.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr2@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqMsq.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr2@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqNumscale.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fqConstSum.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr@gmail.tmt"));
    submitPage.submitWithoutConfirmationEmail();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    assertNotNull(BackDoor.getFeedbackResponse(fq.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.alice.b@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fqPartial.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr3@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fqMcq.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr2@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fqMsq.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr2@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fqNumscale.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fqConstSum.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr@gmail.tmt"));
    submitPage = loginToInstructorFeedbackSubmitPage("IFSubmitUiT.instr", "Open Session");
    submitPage.verifyHtmlMainContent("/instructorFeedbackSubmitPagePartiallyFilled.html");
    ______TS("edit existing response");
    // Test editing an existing response + fill up rest of responses at the same time
    String editedResponse = "Edited response to Alice.";
    submitPage.fillResponseRichTextEditor(2, 0, editedResponse);
    submitPage.fillResponseRichTextEditor(3, 0, "Feedback to instructors");
    submitPage.fillResponseRichTextEditor(4, 1, "Feedback to instructor 2.");
    submitPage.fillResponseRichTextEditor(4, 2, "Feedback to instructor 4.");
    submitPage.fillResponseRichTextEditor(4, 3, "Feedback to instructor 5.");
    submitPage.chooseMcqOption(5, 0, "UI");
    // Changed from "Algo" to "UI"
    submitPage.chooseMcqOption(6, 0, "UI");
    submitPage.selectRecipient(6, 1, "Teammates Test3");
    submitPage.chooseMcqOption(6, 1, "UI");
    submitPage.selectRecipient(6, 2, "Teammates Test4");
    submitPage.chooseMcqOption(6, 2, "UI");
    // Click on "None of the above", the option will be deselected when another option is clicked
    submitPage.toggleMsqOption(7, 0, "");
    submitPage.toggleMsqOption(7, 0, "UI");
    submitPage.toggleMsqOption(7, 0, "Algo");
    submitPage.toggleMsqOption(7, 0, "Design");
    submitPage.toggleMsqOption(8, 0, "UI");
    submitPage.toggleMsqOption(8, 0, "Algo");
    submitPage.toggleMsqOption(8, 0, "Design");
    submitPage.selectRecipient(8, 1, "Teammates Test3");
    submitPage.toggleMsqOption(8, 1, "Design");
    submitPage.selectRecipient(8, 2, "Teammates Test4");
    submitPage.toggleMsqOption(8, 2, "UI");
    submitPage.chooseMcqOption(9, 0, "Drop out (Team 2)");
    submitPage.toggleMsqOption(10, 0, "Alice Betsy</option></td></div>'\" (Team 1</td></div>'\")");
    submitPage.toggleMsqOption(10, 0, "Benny Charles (Team 1</td></div>'\")");
    submitPage.toggleMsqOption(10, 0, "Charlie Davis (Team 2)");
    submitPage.toggleMsqOption(10, 0, "Extra guy (Team 2)");
    submitPage.chooseMcqOption(11, 0, "Team 2");
    submitPage.toggleMsqOption(12, 0, "Team 1</td></div>'\"");
    submitPage.toggleMsqOption(12, 0, "Team 3");
    submitPage.fillResponseTextBox(13, 0, "5");
    submitPage.selectRecipient(14, 0, "Teammates Test2");
    submitPage.fillResponseTextBox(14, 0, "1.5");
    submitPage.selectRecipient(14, 1, "Teammates Test3");
    submitPage.fillResponseTextBox(14, 1, "2");
    submitPage.selectRecipient(14, 2, "Teammates Test4");
    submitPage.fillResponseTextBox(14, 2, "3.5");
    submitPage.chooseMcqOption(15, 0, "Teammates Test2");
    submitPage.toggleMsqOption(16, 0, "Teammates Test");
    submitPage.toggleMsqOption(16, 0, "Teammates Test3");
    submitPage.fillResponseTextBox(17, 0, 0, "70");
    submitPage.fillResponseTextBox(17, 0, 1, "30");
    submitPage.fillResponseTextBox(18, 0, 0, "90");
    submitPage.fillResponseTextBox(18, 1, 0, "110");
    submitPage.fillResponseTextBox(18, 2, 0, "100");
    submitPage.fillResponseTextBox(19, 0, 0, "85");
    submitPage.fillResponseTextBox(19, 1, 0, "110");
    submitPage.fillResponseTextBox(19, 2, 0, "105");
    submitPage.fillResponseTextBox(20, 0, 0, "35");
    submitPage.fillResponseTextBox(20, 0, 1, "40");
    submitPage.fillResponseTextBox(20, 0, 2, "25");
    submitPage.fillResponseTextBox(20, 1, 0, "10");
    submitPage.fillResponseTextBox(20, 1, 1, "50");
    submitPage.fillResponseTextBox(20, 1, 2, "40");
    submitPage.fillResponseTextBox(20, 2, 0, "15");
    submitPage.fillResponseTextBox(20, 2, 1, "35");
    submitPage.fillResponseTextBox(20, 2, 2, "50");
    // Just check the edited responses, and two new response.
    assertNull(BackDoor.getFeedbackResponse(fq.getId(), "IFSubmitUiT.instr@gmail.tmt", "Team 2"));
    assertNull(BackDoor.getFeedbackResponse(fqConstSum2.getId(), "IFSubmitUiT.instr@gmail.tmt", "Team 1</td></div>'\""));
    assertNull(BackDoor.getFeedbackResponse(fqConstSum2.getId(), "IFSubmitUiT.instr@gmail.tmt", "Team 2"));
    assertNull(BackDoor.getFeedbackResponse(fqConstSum2.getId(), "IFSubmitUiT.instr@gmail.tmt", "Team 3"));
    // checks that "" can be submitted and other choices reset when "" is clicked
    submitPage.toggleMsqOption(21, 0, "Team 3");
    submitPage.toggleMsqOption(21, 0, "");
    submitPage.submitWithoutConfirmationEmail();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    assertEquals("<p>" + editedResponse + "</p>", BackDoor.getFeedbackResponse(fq.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.alice.b@gmail.tmt").getResponseDetails().getAnswerString());
    fq = BackDoor.getFeedbackQuestion("IFSubmitUiT.CS2104", "First Session", 7);
    assertNotNull(BackDoor.getFeedbackResponse(fq.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr@gmail.tmt"));
    assertEquals("UI", BackDoor.getFeedbackResponse(fqMcq.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr2@gmail.tmt").getResponseDetails().getAnswerString());
    FeedbackMsqResponseDetails frMsq = (FeedbackMsqResponseDetails) BackDoor.getFeedbackResponse(fqMsq.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr2@gmail.tmt").getResponseDetails();
    assertFalse(frMsq.contains("UI"));
    assertTrue(frMsq.contains("Algo"));
    assertFalse(frMsq.contains("Design"));
    FeedbackNumericalScaleResponseDetails frNumscale = (FeedbackNumericalScaleResponseDetails) BackDoor.getFeedbackResponse(fqNumscale.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr@gmail.tmt").getResponseDetails();
    assertEquals("5", frNumscale.getAnswerString());
    FeedbackConstantSumResponseDetails frConstSum = (FeedbackConstantSumResponseDetails) BackDoor.getFeedbackResponse(fqConstSum.getId(), "IFSubmitUiT.instr@gmail.tmt", "IFSubmitUiT.instr@gmail.tmt").getResponseDetails();
    assertEquals("70, 30", frConstSum.getAnswerString());
    FeedbackConstantSumResponseDetails frConstSum0 = (FeedbackConstantSumResponseDetails) BackDoor.getFeedbackResponse(fqConstSum2.getId(), "IFSubmitUiT.instr@gmail.tmt", "Team 1</td></div>'\"").getResponseDetails();
    assertEquals("90", frConstSum0.getAnswerString());
    FeedbackConstantSumResponseDetails frConstSum1 = (FeedbackConstantSumResponseDetails) BackDoor.getFeedbackResponse(fqConstSum2.getId(), "IFSubmitUiT.instr@gmail.tmt", "Team 2").getResponseDetails();
    assertEquals("110", frConstSum1.getAnswerString());
    FeedbackConstantSumResponseDetails frConstSum2 = (FeedbackConstantSumResponseDetails) BackDoor.getFeedbackResponse(fqConstSum2.getId(), "IFSubmitUiT.instr@gmail.tmt", "Team 3").getResponseDetails();
    assertEquals("100", frConstSum2.getAnswerString());
    submitPage = loginToInstructorFeedbackSubmitPage("IFSubmitUiT.instr", "Open Session");
    submitPage.verifyHtmlMainContent("/instructorFeedbackSubmitPageFullyFilled.html");
}
Also used : FeedbackMsqResponseDetails(teammates.common.datatransfer.questions.FeedbackMsqResponseDetails) FeedbackNumericalScaleResponseDetails(teammates.common.datatransfer.questions.FeedbackNumericalScaleResponseDetails) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) FeedbackConstantSumResponseDetails(teammates.common.datatransfer.questions.FeedbackConstantSumResponseDetails)

Example 3 with FeedbackConstantSumResponseDetails

use of teammates.common.datatransfer.questions.FeedbackConstantSumResponseDetails in project teammates by TEAMMATES.

the class FeedbackResponseDetailsTest method testCreateResponseDetails.

@Test
public void testCreateResponseDetails() {
    ______TS("TEXT Response");
    FeedbackTextQuestionDetails textQuestionDetails = new FeedbackTextQuestionDetails();
    HashMap<String, String[]> requestParameters = new HashMap<>();
    requestParameters.put("questiontype-1", new String[] { "TEXT" });
    requestParameters.put("responsetext-1-0", new String[] { "text answer" });
    FeedbackResponseDetails responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "text answer" }, FeedbackQuestionType.TEXT, textQuestionDetails, requestParameters, 1, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.TEXT);
    assertTrue(responseDetails instanceof FeedbackTextResponseDetails);
    assertEquals("text answer", responseDetails.getAnswerString());
    requestParameters.clear();
    ______TS("MCQ Response: other disabled");
    FeedbackMcqQuestionDetails mcqQuestionDetails = new FeedbackMcqQuestionDetails();
    requestParameters.put("questiontype-2", new String[] { "MCQ" });
    requestParameters.put("responsetext-2-0", new String[] { "mcq option" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "mcq option" }, FeedbackQuestionType.MCQ, mcqQuestionDetails, requestParameters, 2, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.MCQ);
    assertTrue(responseDetails instanceof FeedbackMcqResponseDetails);
    assertEquals("mcq option", responseDetails.getAnswerString());
    requestParameters.clear();
    ______TS("MCQ Response: other enabled, other option not selected");
    FeedbackMcqQuestionDetails mcqQuestionDetailsWithOtherOptionOtherNotSelected = new FeedbackMcqQuestionDetails();
    requestParameters.put("questiontype-3", new String[] { "MCQ" });
    requestParameters.put("responsetext-3-0", new String[] { "an answer" });
    requestParameters.put("mcqIsOtherOptionAnswer-3-0", new String[] { "0" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "an answer" }, FeedbackQuestionType.MCQ, mcqQuestionDetailsWithOtherOptionOtherNotSelected, requestParameters, 3, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.MCQ);
    assertTrue(responseDetails instanceof FeedbackMcqResponseDetails);
    assertEquals("an answer", responseDetails.getAnswerString());
    assertFalse(((FeedbackMcqResponseDetails) responseDetails).isOtherOptionAnswer());
    requestParameters.clear();
    ______TS("MCQ Response: other enabled, other option selected");
    FeedbackMcqQuestionDetails mcqQuestionDetailsWithOtherOptionOtherSelected = new FeedbackMcqQuestionDetails();
    requestParameters.put("questiontype-4", new String[] { "MCQ" });
    requestParameters.put("responsetext-4-0", new String[] { "my answer" });
    requestParameters.put("mcqIsOtherOptionAnswer-4-0", new String[] { "1" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "my answer" }, FeedbackQuestionType.MCQ, mcqQuestionDetailsWithOtherOptionOtherSelected, requestParameters, 4, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.MCQ);
    assertTrue(responseDetails instanceof FeedbackMcqResponseDetails);
    assertEquals("my answer", responseDetails.getAnswerString());
    assertTrue(((FeedbackMcqResponseDetails) responseDetails).isOtherOptionAnswer());
    requestParameters.clear();
    ______TS("MSQ Response: other disabled");
    FeedbackMsqQuestionDetails msqQuestionDetails = new FeedbackMsqQuestionDetails();
    requestParameters.put("questiontype-5", new String[] { "MSQ" });
    requestParameters.put("responsetext-5-0", new String[] { "msq option 1", "msq option 2", "msq option 3" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "msq option 1", "msq option 2", "msq option 3" }, FeedbackQuestionType.MSQ, msqQuestionDetails, requestParameters, 5, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.MSQ);
    assertTrue(responseDetails instanceof FeedbackMsqResponseDetails);
    assertEquals("msq option 1, msq option 2, msq option 3", responseDetails.getAnswerString());
    requestParameters.clear();
    ______TS("MSQ Response: other disabled, other option not selected");
    msqQuestionDetails = new FeedbackMsqQuestionDetails();
    requestParameters.put("questiontype-6", new String[] { "MSQ" });
    requestParameters.put("responsetext-6-0", new String[] { "msq option 1", "msq option 2", "msq option 3" });
    requestParameters.put("msqIsOtherOptionAnswer-6-0", new String[] { "0" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "msq option 1", "msq option 2", "msq option 3" }, FeedbackQuestionType.MSQ, msqQuestionDetails, requestParameters, 6, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.MSQ);
    assertTrue(responseDetails instanceof FeedbackMsqResponseDetails);
    assertEquals("msq option 1, msq option 2, msq option 3", responseDetails.getAnswerString());
    assertFalse(((FeedbackMsqResponseDetails) responseDetails).isOtherOptionAnswer());
    requestParameters.clear();
    ______TS("MSQ Response: other disabled, other option selected");
    msqQuestionDetails = new FeedbackMsqQuestionDetails();
    requestParameters.put("questiontype-7", new String[] { "MSQ" });
    requestParameters.put("responsetext-7-0", new String[] { "msq option 1", "msq option 2", "msq option 3", "other answer" });
    requestParameters.put("msqIsOtherOptionAnswer-7-0", new String[] { "1" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "msq option 1", "msq option 2", "msq option 3", "other answer" }, FeedbackQuestionType.MSQ, msqQuestionDetails, requestParameters, 7, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.MSQ);
    assertTrue(responseDetails instanceof FeedbackMsqResponseDetails);
    assertEquals("msq option 1, msq option 2, msq option 3, other answer", responseDetails.getAnswerString());
    assertTrue(((FeedbackMsqResponseDetails) responseDetails).isOtherOptionAnswer());
    assertEquals("other answer", ((FeedbackMsqResponseDetails) responseDetails).getOtherFieldContent());
    requestParameters.clear();
    ______TS("NUMSCALE Response: typical case");
    FeedbackNumericalScaleQuestionDetails numericalScaleQuestionDetails = new FeedbackNumericalScaleQuestionDetails();
    numericalScaleQuestionDetails.setMaxScale(5);
    numericalScaleQuestionDetails.setMinScale(-5);
    requestParameters.put("questiontype-6", new String[] { "NUMSCALE" });
    requestParameters.put("responsetext-6-0", new String[] { "-3.5" });
    requestParameters.put("numscalemin-6-0", new String[] { "-5" });
    requestParameters.put("numscalemax-6-0", new String[] { "5" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "-3.5" }, FeedbackQuestionType.NUMSCALE, numericalScaleQuestionDetails, requestParameters, 6, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.NUMSCALE);
    assertTrue(responseDetails instanceof FeedbackNumericalScaleResponseDetails);
    assertEquals("-3.5", responseDetails.getAnswerString());
    requestParameters.clear();
    ______TS("NUMSCALE Response: wrong format");
    requestParameters.put("questiontype-6", new String[] { "NUMSCALE" });
    requestParameters.put("responsetext-6-0", new String[] { "-0.5.3" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "-0.5.3" }, FeedbackQuestionType.NUMSCALE, numericalScaleQuestionDetails, requestParameters, 6, 0);
    assertNull(responseDetails);
    requestParameters.clear();
    ______TS("CONSTSUM Response: typical case");
    String questionText = "question text";
    List<String> constSumOptions = new ArrayList<>();
    constSumOptions.add("Option 1");
    constSumOptions.add("Option 2");
    boolean isPointsPerOption = false;
    int points = 100;
    boolean shouldForceUnevenDistribution = false;
    FeedbackConstantSumQuestionDetails constantSumQuestionDetails = new FeedbackConstantSumQuestionDetails(questionText, constSumOptions, isPointsPerOption, points, shouldForceUnevenDistribution);
    requestParameters.put("questiontype-7", new String[] { "CONSTSUM" });
    requestParameters.put("responsetext-7-0", new String[] { "20", "80" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "20", "80" }, FeedbackQuestionType.CONSTSUM, constantSumQuestionDetails, requestParameters, 7, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.CONSTSUM);
    assertTrue(responseDetails instanceof FeedbackConstantSumResponseDetails);
    assertEquals("20, 80", responseDetails.getAnswerString());
    requestParameters.clear();
    ______TS("CONTRIB Response: typical case");
    questionText = "question text";
    FeedbackContributionQuestionDetails contribQuestionDetails = new FeedbackContributionQuestionDetails(questionText);
    requestParameters.put("questiontype-8", new String[] { "CONTRIB" });
    requestParameters.put("responsetext-8-0", new String[] { "100" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "100" }, FeedbackQuestionType.CONTRIB, contribQuestionDetails, requestParameters, 8, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.CONTRIB);
    assertTrue(responseDetails instanceof FeedbackContributionResponseDetails);
    assertEquals("100", responseDetails.getAnswerString());
    requestParameters.clear();
    ______TS("RUBRIC Response: invalid indexes in response");
    questionText = "question text";
    FeedbackRubricQuestionDetails rubricQuestionDetails = new FeedbackRubricQuestionDetails(questionText);
    requestParameters.put("questiontype-9", new String[] { "RUBRIC" });
    requestParameters.put("responsetext-9-0", new String[] { "0-0,1-0" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "0-0,1-0" }, FeedbackQuestionType.RUBRIC, rubricQuestionDetails, requestParameters, 9, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.RUBRIC);
    assertTrue(responseDetails instanceof FeedbackRubricResponseDetails);
    assertEquals("[]", responseDetails.getAnswerString());
    requestParameters.clear();
    ______TS("RUBRIC Response: typical case");
    rubricQuestionDetails.setNumOfRubricChoices(rubricQuestionDetails.getNumOfRubricChoices() + 1);
    rubricQuestionDetails.getRubricChoices().add("choice1");
    rubricQuestionDetails.setNumOfRubricSubQuestions(rubricQuestionDetails.getNumOfRubricSubQuestions() + 1);
    rubricQuestionDetails.getRubricSubQuestions().add("sub-qn1");
    rubricQuestionDetails.setNumOfRubricSubQuestions(rubricQuestionDetails.getNumOfRubricSubQuestions() + 1);
    rubricQuestionDetails.getRubricSubQuestions().add("sub-qn2");
    requestParameters.put("questiontype-9", new String[] { "RUBRIC" });
    requestParameters.put("responsetext-9-0", new String[] { "0-0,1-0" });
    responseDetails = FeedbackResponseDetails.createResponseDetails(new String[] { "0-0,1-0" }, FeedbackQuestionType.RUBRIC, rubricQuestionDetails, requestParameters, 9, 0);
    assertEquals(responseDetails.questionType, FeedbackQuestionType.RUBRIC);
    assertTrue(responseDetails instanceof FeedbackRubricResponseDetails);
    assertEquals("[0, 0]", responseDetails.getAnswerString());
    requestParameters.clear();
}
Also used : FeedbackRubricResponseDetails(teammates.common.datatransfer.questions.FeedbackRubricResponseDetails) FeedbackMsqResponseDetails(teammates.common.datatransfer.questions.FeedbackMsqResponseDetails) FeedbackNumericalScaleResponseDetails(teammates.common.datatransfer.questions.FeedbackNumericalScaleResponseDetails) FeedbackConstantSumQuestionDetails(teammates.common.datatransfer.questions.FeedbackConstantSumQuestionDetails) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) FeedbackContributionResponseDetails(teammates.common.datatransfer.questions.FeedbackContributionResponseDetails) FeedbackConstantSumResponseDetails(teammates.common.datatransfer.questions.FeedbackConstantSumResponseDetails) FeedbackMcqQuestionDetails(teammates.common.datatransfer.questions.FeedbackMcqQuestionDetails) FeedbackMcqResponseDetails(teammates.common.datatransfer.questions.FeedbackMcqResponseDetails) FeedbackMsqQuestionDetails(teammates.common.datatransfer.questions.FeedbackMsqQuestionDetails) FeedbackRubricQuestionDetails(teammates.common.datatransfer.questions.FeedbackRubricQuestionDetails) FeedbackContributionQuestionDetails(teammates.common.datatransfer.questions.FeedbackContributionQuestionDetails) FeedbackTextQuestionDetails(teammates.common.datatransfer.questions.FeedbackTextQuestionDetails) FeedbackResponseDetails(teammates.common.datatransfer.questions.FeedbackResponseDetails) FeedbackNumericalScaleQuestionDetails(teammates.common.datatransfer.questions.FeedbackNumericalScaleQuestionDetails) FeedbackTextResponseDetails(teammates.common.datatransfer.questions.FeedbackTextResponseDetails) Test(org.testng.annotations.Test)

Aggregations

FeedbackConstantSumResponseDetails (teammates.common.datatransfer.questions.FeedbackConstantSumResponseDetails)3 FeedbackMsqResponseDetails (teammates.common.datatransfer.questions.FeedbackMsqResponseDetails)3 FeedbackNumericalScaleResponseDetails (teammates.common.datatransfer.questions.FeedbackNumericalScaleResponseDetails)3 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)2 FeedbackContributionResponseDetails (teammates.common.datatransfer.questions.FeedbackContributionResponseDetails)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Test (org.testng.annotations.Test)1 FeedbackConstantSumQuestionDetails (teammates.common.datatransfer.questions.FeedbackConstantSumQuestionDetails)1 FeedbackContributionQuestionDetails (teammates.common.datatransfer.questions.FeedbackContributionQuestionDetails)1 FeedbackMcqQuestionDetails (teammates.common.datatransfer.questions.FeedbackMcqQuestionDetails)1 FeedbackMcqResponseDetails (teammates.common.datatransfer.questions.FeedbackMcqResponseDetails)1 FeedbackMsqQuestionDetails (teammates.common.datatransfer.questions.FeedbackMsqQuestionDetails)1 FeedbackNumericalScaleQuestionDetails (teammates.common.datatransfer.questions.FeedbackNumericalScaleQuestionDetails)1 FeedbackResponseDetails (teammates.common.datatransfer.questions.FeedbackResponseDetails)1 FeedbackRubricQuestionDetails (teammates.common.datatransfer.questions.FeedbackRubricQuestionDetails)1 FeedbackRubricResponseDetails (teammates.common.datatransfer.questions.FeedbackRubricResponseDetails)1 FeedbackTextQuestionDetails (teammates.common.datatransfer.questions.FeedbackTextQuestionDetails)1 FeedbackTextResponseDetails (teammates.common.datatransfer.questions.FeedbackTextResponseDetails)1