@Override
 public void setProperty(String propertyName, Object propertyValue)
     throws UnknownPropertyException {
   BrixAssessmentItemTypeMsgPayload specificPayload = (BrixAssessmentItemTypeMsgPayload) payload;
   switch (propertyName) {
     case "Quiz":
       Quiz quiz = (Quiz) propertyValue;
       specificPayload.Assessment_Items = new ArrayList<>();
       for (Question question : quiz.getQuestions()) {
         BrixAssessmentItemTypeMsgPayload.AssessmentItem assessmentItem =
             specificPayload.new AssessmentItem();
         assessmentItem.Assessment_Item_Source_System_Record_Id = question.getId();
         assessmentItem.Assessment_Item_Type_Code = "MultipleChoice_4";
         assessmentItem.Answers = new ArrayList<>();
         for (com.pearson.test.daalt.dataservice.model.Answer ans : question.getAnswers()) {
           BrixAssessmentItemTypeMsgPayload.AssessmentItem.Answer answer =
               assessmentItem.new Answer();
           answer.Answer_Source_System_Record_Id = ans.getId();
           assessmentItem.Answers.add(answer);
         }
         specificPayload.Assessment_Items.add(assessmentItem);
       }
       break;
     case "Transaction_Type_Code":
       specificPayload.Transaction_Type_Code = propertyValue.toString();
       break;
     default:
       throw new UnknownPropertyException(
           "Failed to build message due to unknown property : " + propertyName);
   }
 }
  @Test
  public void loadBasicTestData() throws Exception {
    testActionFactoryV1 =
        new com.pearson.test.daalt.dataservice.request.action.version01
            .SubPubSeerTestActionFactory();

    TestDataRequest zeroRequest;
    TestDataRequest firstRequest;
    TestDataRequest secondRequest;
    TestDataRequest thirdRequest;
    TestData testData;
    Course course;
    CourseSection courseSection;
    Assignment assignmentToAdd;
    Instructor instr;
    Student student;
    StringBuilder timeOnTaskOutput = new StringBuilder("\nTime on task summary...");

    try {
      zeroRequest = new BasicTestDataRequest();
      firstRequest = new BasicTestDataRequest();
      secondRequest = new BasicTestDataRequest();
      thirdRequest = new BasicTestDataRequest();
      testData = new BasicTestData("MessageTransformInstructorChangesGradeScenario");

      // add instructor
      com.pearson.test.daalt.dataservice.User instrFromConfig = getEngine().getInstructor();
      instr =
          new BasicInstructor(
              instrFromConfig.getUserName(),
              instrFromConfig.getPassword(),
              instrFromConfig.getId(),
              instrFromConfig.getFirstName(),
              instrFromConfig.getLastName());
      testData.addInstructor(instr);

      // add student
      com.pearson.test.daalt.dataservice.User student01FromConfig = getEngine().getStudent01();
      student =
          new BasicStudent(
              student01FromConfig.getUserName(),
              student01FromConfig.getPassword(),
              student01FromConfig.getId(),
              student01FromConfig.getFirstName(),
              student01FromConfig.getLastName());
      testData.addStudent(student);

      // create course section
      course = new BasicCourse();
      courseSection = new BasicCourseSection();
      courseSection.setInstructor(instr);
      // create Book
      Product book = new BasicProduct();
      courseSection.addBook(book);
      course.addCourseSection(courseSection);
      testData.addCourse(course);
      // add action to create course section
      TestAction createCourseSection =
          testActionFactoryV1.getCreateCourseSectionTestAction(courseSection);
      zeroRequest.addTestAction(createCourseSection);

      zeroRequest.executeAllActions();

      // sleep to ensure that Course_Section_Learning_Resource arrives before
      // Learning_Module_Content
      Thread.sleep(10000);

      // We need to enroll the instructor to the course, or we will get 401 when the instructor make
      // the call.
      // add action to enroll instructor
      TestAction enrollInstr =
          testActionFactoryV1.getEnrollInstructorTestAction(instr, courseSection);
      firstRequest.addTestAction(enrollInstr);

      // enroll student1
      courseSection.addStudent(student);
      // add action to enroll student1
      TestAction enrollStudent1 =
          testActionFactoryV1.getEnrollStudentTestAction(student, courseSection);
      firstRequest.addTestAction(enrollStudent1);

      // add assignment to course section
      /*
       * Using an AssignmentFactory.
       * First implementation returns from a pre-defined selection of Assignments identified by Enum.
       * Later, we can discuss possible ways of improving on the factory design.
       *
       * Two other factories that would be useful:
       * 		Product (aka Book) - defines learning resource relationships
       * 		AssignmentPerformance - defines the precise interactions between a student and an Assignment
       */
      if (assignmentFactory == null) {
        assignmentFactory = new AssignmentFactory();
      }
      assignmentToAdd =
          assignmentFactory.getAssignmentByEnum(
              AssignmentFactory.AssignmentLibrary.CHAPTER_QUIZ_ONLY);
      assignmentToAdd.setAllTargetIdsTrue();

      System.out.println(assignmentToAdd.getStructure());

      Calendar nowCal = createDueDate();

      assignmentToAdd.setDueDate(nowCal.getTime());

      assignmentToAdd.setTitle("DAALT SQE Test Assignment");
      courseSection.addAssignment(assignmentToAdd);
      // add action to add assignment to course section
      TestAction addAssignment =
          testActionFactoryV1.getAddAssignmentTestAction(instr, courseSection, assignmentToAdd);
      firstRequest.addTestAction(addAssignment);

      // Chapter Quiz
      Quiz chapQuiz = assignmentToAdd.getChapters().get(0).getChapterQuiz();
      for (Question ques : chapQuiz.getQuestions()) {
        Answer answer = ques.getSubQuestions().get(0).getCorrectAnswer().getAnswers().get(0);
        MultiValueAttempt attempt =
            getMultiValueRadioButtonAttempt(
                ques,
                student, /*timeSpent*/
                30, /*attemptNumber*/
                1,
                answer, /*pointsEarned*/
                ques.getPointsPossible(), /*isFinalAttempt*/
                true);
        ques.addAttempt(attempt);
        timeOnTaskOutput.append(
            "\n...assessment time : "
                + student.getPersonId()
                + " : "
                + ques.getId()
                + " : 30 seconds");

        // Question completion activity
        QuestionCompletionActivity questionCompletionActivity =
            new QuestionCompletionActivity(student, ques.getPointsPossible());
        ques.addCompletionActivity(questionCompletionActivity);
        TestAction attemptQuestionTestAction =
            testActionFactoryV1.getAttemptQuestionTestAction(
                courseSection, assignmentToAdd, chapQuiz, ques, attempt);
        firstRequest.addTestAction(attemptQuestionTestAction);
      }

      // First Complete Quiz
      QuizCompletionActivity chapQuizCompletionActivity1 = new QuizCompletionActivity(student);
      for (Question ques : chapQuiz.getQuestions()) {
        chapQuizCompletionActivity1.addQuestionPerf(ques.getId(), ques.getPointsPossible());
      }
      chapQuiz.addCompletionActivity(chapQuizCompletionActivity1);
      TestAction completeChapQuizTestAction1 =
          testActionFactoryV1.getCompleteQuizTestAction(
              courseSection, assignmentToAdd, chapQuiz, chapQuizCompletionActivity1);
      firstRequest.addTestAction(completeChapQuizTestAction1);

      firstRequest.executeAllActions();

      // Instructor changes grade
      // Second Complete Quiz
      QuizCompletionActivity chapQuizCompletionActivity2 = new QuizCompletionActivity(student);
      for (Question ques : chapQuiz.getQuestions()) {
        chapQuizCompletionActivity2.addQuestionPerf(ques.getId(), /*pointsEarned*/ 1f);
      }
      chapQuiz.addCompletionActivity(chapQuizCompletionActivity2);
      chapQuiz.removeCompletionActivity(chapQuizCompletionActivity1);
      TestAction assessmentPerformanceChapQuizTestAction =
          testActionFactoryV1.getAssessmentPerformanceTestAction(
              courseSection, assignmentToAdd, chapQuiz, chapQuizCompletionActivity2);
      secondRequest.addTestAction(assessmentPerformanceChapQuizTestAction);

      secondRequest.executeAllActions();
      assignmentToAdd.setDueDatePassed(true);

      TestAction reSendSeedData =
          testActionFactory.getReSendSeedDataTestAction(courseSection, assignmentToAdd);
      thirdRequest.addTestAction(reSendSeedData);

      thirdRequest.executeAllActions();

    } catch (Exception e) {
      getEngine().getSuite().setDidCreationTestsComplete(false);
      throw e;
    }

    // pass TestData to validation engine
    DaaltDataServiceValidationEngine validationEngine = new DaaltDataServiceValidationEngine();
    List<Validation> validationList = validationEngine.getValidationsForTestData(testData);
    for (Validation val : validationList) {
      getCurrentTestCase().getValidations().add(val);
      if (getEngine().isPrintExpectedOutput()) {
        System.out.println(val.getExpectedResultsPrintString());
      }
    }

    if (getEngine().isPrintToT()) {
      timeOnTaskOutput.append("\n");
      System.out.println(timeOnTaskOutput.toString());
    }
  }