Search in sources :

Example 1 with FeedbackMcqQuestionDetails

use of teammates.common.datatransfer.questions.FeedbackMcqQuestionDetails 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)

Example 2 with FeedbackMcqQuestionDetails

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

the class InstructorFeedbackQuestionEditActionTest method testExecuteAndPostProcessMcq.

@Test
public void testExecuteAndPostProcessMcq() {
    DataBundle dataBundle = loadDataBundle("/FeedbackSessionQuestionTypeTest.json");
    removeAndRestoreDataBundle(dataBundle);
    InstructorAttributes instructor1ofCourse1 = dataBundle.instructors.get("instructor1OfCourse1");
    gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
    FeedbackSessionAttributes fs = dataBundle.feedbackSessions.get("mcqSession");
    FeedbackQuestionAttributes fq = FeedbackQuestionsLogic.inst().getFeedbackQuestion(fs.getFeedbackSessionName(), fs.getCourseId(), 1);
    FeedbackMcqQuestionDetails mcqDetails = (FeedbackMcqQuestionDetails) fq.getQuestionDetails();
    FeedbackResponsesDb frDb = new FeedbackResponsesDb();
    ______TS("Edit text");
    // There is already responses for this question
    assertFalse(frDb.getFeedbackResponsesForQuestion(fq.getId()).isEmpty());
    String[] editTextParams = { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, fq.giverType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, fq.recipientType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, Integer.toString(fq.questionNumber), Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "MCQ", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "What do you like best about the class?", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, Integer.toString(mcqDetails.getNumOfMcqChoices()), Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-0", mcqDetails.getMcqChoices().get(0), Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-1", mcqDetails.getMcqChoices().get(1), Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", 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", Const.ParamsNames.FEEDBACK_QUESTION_ID, fq.getId(), Const.ParamsNames.FEEDBACK_QUESTION_MCQ_GENERATED_OPTIONS, FeedbackParticipantType.NONE.toString() };
    InstructorFeedbackQuestionEditAction a = getAction(editTextParams);
    RedirectResult r = getRedirectResult(a);
    assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, "FSQTT.idOfTypicalCourse1", "MCQ+Session", "FSQTT.idOfInstructor1OfCourse1", false), r.getDestinationWithParams());
    assertEquals(Const.StatusMessages.FEEDBACK_QUESTION_EDITED, r.getStatusMessage());
    assertFalse(r.isError);
    // All existing response should remain
    assertFalse(frDb.getFeedbackResponsesForQuestion(fq.getId()).isEmpty());
    ______TS("Edit options");
    // There should already be responses for this question
    assertFalse(frDb.getFeedbackResponsesForQuestion(fq.getId()).isEmpty());
    String[] editOptionParams = { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, fq.giverType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, fq.recipientType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, Integer.toString(fq.questionNumber), Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "MCQ", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "What do you like best about the class?", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, "5", Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-0", "The Content", // empty option
    Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-2", // empty option
    "", // empty option with extra whitespace
    Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-3", "          ", Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-4", "The Atmosphere", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", 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", Const.ParamsNames.FEEDBACK_QUESTION_ID, fq.getId(), Const.ParamsNames.FEEDBACK_QUESTION_MCQ_GENERATED_OPTIONS, FeedbackParticipantType.NONE.toString() };
    a = getAction(editOptionParams);
    r = getRedirectResult(a);
    assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, "FSQTT.idOfTypicalCourse1", "MCQ+Session", "FSQTT.idOfInstructor1OfCourse1", false), r.getDestinationWithParams());
    assertEquals(Const.StatusMessages.FEEDBACK_QUESTION_EDITED, r.getStatusMessage());
    assertFalse(r.isError);
    // All existing response should be deleted as option is edited
    assertTrue(frDb.getFeedbackResponsesForQuestion(fq.getId()).isEmpty());
    ______TS("Edit to generated");
    String[] editToGeneratedOptionParams = { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, fq.giverType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, fq.recipientType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, Integer.toString(fq.questionNumber), Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "MCQ", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "What do you like best about the class?", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, "4", Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-0", "The Content", // empty option
    Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-1", // empty option
    "", // empty option with extra whitespace
    Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-2", "          ", Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-3", "The Atmosphere", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", 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", Const.ParamsNames.FEEDBACK_QUESTION_ID, fq.getId(), Const.ParamsNames.FEEDBACK_QUESTION_MCQ_GENERATED_OPTIONS, FeedbackParticipantType.STUDENTS.toString() };
    a = getAction(editToGeneratedOptionParams);
    r = getRedirectResult(a);
    assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, "FSQTT.idOfTypicalCourse1", "MCQ+Session", "FSQTT.idOfInstructor1OfCourse1", false), r.getDestinationWithParams());
    assertEquals(Const.StatusMessages.FEEDBACK_QUESTION_EDITED, r.getStatusMessage());
    assertFalse(r.isError);
    ______TS("Delete Feedback");
    String[] deleteParams = { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, fq.giverType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, fq.recipientType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, Integer.toString(fq.questionNumber), Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "MCQ", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, "4", Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-0", "The Content", // empty option
    Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-1", // empty option
    "", // empty option with extra whitespace
    Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-2", "          ", Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-3", "The Atmosphere", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", 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, "delete", Const.ParamsNames.FEEDBACK_QUESTION_ID, fq.getId(), Const.ParamsNames.FEEDBACK_QUESTION_MCQ_GENERATED_OPTIONS, FeedbackParticipantType.STUDENTS.toString() };
    a = getAction(deleteParams);
    r = getRedirectResult(a);
    assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, "FSQTT.idOfTypicalCourse1", "MCQ+Session", "FSQTT.idOfInstructor1OfCourse1", false), r.getDestinationWithParams());
    assertEquals(Const.StatusMessages.FEEDBACK_QUESTION_DELETED, r.getStatusMessage());
    assertFalse(r.isError);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) InstructorFeedbackQuestionEditAction(teammates.ui.controller.InstructorFeedbackQuestionEditAction) DataBundle(teammates.common.datatransfer.DataBundle) RedirectResult(teammates.ui.controller.RedirectResult) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) FeedbackResponsesDb(teammates.storage.api.FeedbackResponsesDb) FeedbackMcqQuestionDetails(teammates.common.datatransfer.questions.FeedbackMcqQuestionDetails) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Test(org.testng.annotations.Test)

Aggregations

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