*/
@Test
public void testGetResultVotes(){
final Question quest = createQuestion("Do you like action movies", "Yes/No");
final Poll poll = createPoll(new Date(), quest, "ACTMOV", this.userAccount, Boolean.TRUE, Boolean.TRUE);
final QuestionAnswer qansw = createQuestionAnswer("Yes", quest, "2023");
final QuestionAnswer qansw2 =createQuestionAnswer("No", quest, "2024");
// Create poll results for QuestionAnswer2 = 3
createPollResults(qansw2, poll);
createPollResults(qansw2, poll);
createPollResults(qansw2, poll);
// Create poll results for QuestionAnswer1 = 7
createPollResults(qansw, poll);
createPollResults(qansw, poll);
createPollResults(qansw, poll);
createPollResults(qansw, poll);
createPollResults(qansw, poll);
createPollResults(qansw, poll);
createPollResults(qansw, poll);
final List<PollBeanResult> pollbean = this.pollService
.getResultVotes(poll);
assertEquals(pollbean.size(), 2);
for (PollBeanResult pollBeanResult : pollbean) {
if (pollBeanResult.getAnswerBean().getAnswerId()
.equals(qansw.getQuestionAnswerId())) {
assertEquals("For answer1 should be equals",
pollBeanResult.getResult().toString(), "7");
}
if (pollBeanResult.getAnswerBean().getAnswerId()
.equals(qansw2.getQuestionAnswerId())) {
assertEquals("For answer2 should be equals",
pollBeanResult.getResult().toString(), "3");
}
}