/** @throws Exception */
  @Test
  public void save() throws Exception {
    List<QuestionType> questionTypesOld = questionTypeService.findAll();
    assertFalse(questionTypesOld.isEmpty());

    User patient1 = userService.findUserByLogin("sysuser1");
    assertNotNull(patient1);

    QuestionType questionType = new QuestionType();
    questionType.setAnswerDataType(AnswerDataType.BOOLEAN);
    questionType.setAnswers(new ArrayList<Answer>());
    questionType.setType(Type.SINGLE_CHOICE_LIST);
    NoAnswer answer1 = new NoAnswer();
    answer1.setActive(false);
    answer1.setAnswer("test");
    answer1.setQuestionType(questionType);
    answer1.setSortOrder(0);
    questionType.getAnswers().add(answer1);

    Answer answer2 = new Answer();
    answer2.setActive(true);
    answer2.setAnswer("test");
    answer2.setQuestionType(questionType);
    answer2.setSortOrder(1);
    questionType.getAnswers().add(answer2);

    questionTypeService.save(patient1.getId(), questionType);

    List<QuestionType> questionTypes = questionTypeService.findAll();
    assertEquals(questionTypesOld.size() + 1, questionTypes.size());

    assertEquals(
        questionType.getUser().getId(),
        questionTypes.get(questionTypes.size() - 1).getUser().getId());
  }
  /** @throws Exception */
  @Test
  public void findForUser() throws Exception {
    User patient1 = userService.findUserByLogin("sysuser1");
    assertNotNull(patient1);

    QuestionType qt =
        questionTypeService.find(
            patient1.getId(), QuestionType.Type.SINGLE_CHOICE_LIST, AnswerDataType.BOOLEAN);
    assertNotNull(qt);
  }