public void testGetAnswersToQuestion() throws wrongTypeException { int id = 8414075; ArrayList<Answer> answer = answerSource.getAnswers(id); int numberOfAnswers = questionSource.getNumberOfAnswers(id); Log.v("numberOfAnswers", Integer.toString(numberOfAnswers)); Assert.assertEquals(answer.size(), numberOfAnswers); }
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); }