Esempio n. 1
0
 public void testAnswerCountIncremented() {
   Question question = new Question("DummyTitle", "DummyBody", "DummyTag");
   questionSource.setQuestion(question);
   Answer answer = new Answer(question.getId(), "Write something");
   answerSource.setAnswer(answer);
   try {
     Question question2 = questionSource.getQuestion(question.getId());
     Assert.assertEquals((question.getAnswerCount() + 1), question2.getAnswerCount());
   } catch (Exception e) {
     Assert.assertTrue(true);
   }
 }
Esempio n. 2
0
 public void testAnswerInRT() {
   Question question = new Question("DummyTitle", "DummyBody", "DummyTag");
   int questionId = questionSource.setQuestion(question);
   Answer answer = new Answer(questionId, "DummyAnswer");
   int answerId = answerSource.setAnswer(answer);
   boolean Match = false;
   answerSource.addAnswerToRT(questionId, answerId);
   try {
     ArrayList<Answer> AnswerList = answerSource.getAnswers(questionId);
     for (Answer answ : AnswerList) {
       if (answ.getId() == answerId) Match = true;
     }
   } catch (Exception e) {
     Assert.assertTrue(true);
   }
   Assert.assertTrue(Match);
 }