/**
* Test get total polls by hashTag.
*/
@Test
public void testGetTotalPollsByHashTag() {
final HashTag hashtag1 = createHashTag("roses");
final HashTag hashtag2 = createHashTag("red");
final HashTag hashtag3 = createHashTag("flowers");
final Poll poll1 = createPoll(myDate.getTime(), this.question,
"DPMU12", this.userAccount, Boolean.TRUE, Boolean.TRUE);
poll1.getHashTags().add(hashtag1);
poll1.getHashTags().add(hashtag2);
poll1.getHashTags().add(hashtag3);
getPollDao().saveOrUpdate(poll1);
final Poll poll2 = createPoll(myDate.getTime(), this.question,
"DPMU13", this.userAccount, Boolean.TRUE, Boolean.TRUE);
poll2.getHashTags().add(hashtag3);
poll2.getHashTags().add(hashtag1);
getPollDao().saveOrUpdate(poll2);
final Poll poll3 = createPoll(myDate.getTime(), this.question,
"DPMU14", this.userAccount, Boolean.TRUE, Boolean.TRUE);
poll3.getHashTags().add(hashtag3);
getPollDao().saveOrUpdate(poll3);
final List<Poll> totalUsagePoll = getPollDao().getPollByHashTagName(
hashtag1.getHashTag(), this.START, this.MAX_RESULTS, TypeSearchResult.HASHTAG, SearchPeriods.ALLTIME);
Assert.assertEquals("Should be", 2, totalUsagePoll.size());
final List<Poll> totalUsagePoll2 = getPollDao().getPollByHashTagName(
hashtag2.getHashTag(), this.START, this.MAX_RESULTS, TypeSearchResult.HASHTAG, SearchPeriods.ALLTIME);
Assert.assertEquals("Should be", 1, totalUsagePoll2.size());
final List<Poll> totalUsagePoll3 = getPollDao().getPollByHashTagName(
hashtag3.getHashTag(), this.START, this.MAX_RESULTS, TypeSearchResult.HASHTAG, SearchPeriods.ALLTIME);
Assert.assertEquals("Should be", 3, totalUsagePoll3.size());
}