Package org.encuestame.persistence.domain.question

Examples of org.encuestame.persistence.domain.question.QuestionAnswer


    /**
     * Test Questions Answer Domain.
     **/
    @Test
    public void testQuestionsAnswer(){
        final QuestionAnswer questionsAns = new QuestionAnswer();
        questionsAns.setQuestions(createQuestion("how old are you", "textbox"));
        questionsAns.setAnswer("25");
        questionsAns.setUniqueAnserHash("");
        questionsAns.setColor("#RRRRRR");
        questionsAns.setCreatedDate(new Date());
        getQuestionDaoImp().saveOrUpdate(questionsAns);
        assertNotNull(questionsAns.getQuestionAnswerId());
    }
View Full Code Here


     * Test {@link SurveyResult} domain.
     */
    @Test
    public void testSurveyResult() {
        final SurveyResult result = new SurveyResult();
        final QuestionAnswer qAnswers = createQuestionAnswer("Spain",
                this.initQuestion, "ORFQT29");
        result.setAnswer(qAnswers);
        result.setQuestion(this.initQuestion);
        result.setSurvey(this.initSurvey);
        result.setTxtResponse("20");
View Full Code Here

     * Test {@link SurveyTemporalResult} domain.
     */
  @Test
    public void testSurveyTemporalResult() {
        final SurveyTemporalResult result = new SurveyTemporalResult();
        final QuestionAnswer qAnswers = createQuestionAnswer("Yes",
                this.initQuestion, "ORFQT31");
        result.setAnswer(qAnswers);
        result.setQuestion(this.initQuestion);
        result.setSurvey(this.initSurvey);
        result.setTxtResponse("3 Cups");
View Full Code Here

   * Test {@link TweetPollSwitch}
   */
  @Test
  public void testTweetPollSwitch() {
    final TweetPollSwitch tpollSwitch = new TweetPollSwitch();
    QuestionAnswer qAnswers = createQuestionAnswer("", this.initQuestion,
        "HxjG823Dm");
    tpollSwitch.setAnswers(qAnswers);
    tpollSwitch.setCodeTweet("cod9kd");
    tpollSwitch.setDateUpdated(new Date());
    tpollSwitch.setRelativeUrl("http://encuestame.org");
View Full Code Here

    **/
    @Test
    public void testRetrievePollResultsById(){
        final Poll poll = createPoll(myDate.getTime(), this.question, "FDKdsadsads125", this.userAccount, Boolean.TRUE, Boolean.TRUE);
        final Question quest = createQuestion("Do you like futboll", "Yes/No");
        final QuestionAnswer qansw = createQuestionAnswer("Yes", quest, "2020");
        final QuestionAnswer qansw2 =createQuestionAnswer("No", quest, "2021");
        createPollResults(qansw2, poll);
        createPollResults(qansw2, poll);
        createPollResults(qansw2, poll);
        createPollResults(qansw, poll);
        createPollResults(qansw, poll);
View Full Code Here

     */
    @Test
    public void testRetrievePollResultsByAnswer(){
        final Poll poll = createPoll(myDate.getTime(), this.question, "FDKL1", this.userAccount, Boolean.TRUE, Boolean.TRUE);
        final Question quest = createQuestion("Do you like futboll", "Yes/No");
        final QuestionAnswer qansw = createQuestionAnswer("Yes", quest, "2020");
        final QuestionAnswer qansw2 =createQuestionAnswer("No", quest, "2021");
        // Create poll results for QuestionAnswer2 = 3
        createPollResults(qansw2, poll);
        createPollResults(qansw2, poll);
        createPollResults(qansw2, poll);
        // Create poll results for QuestionAnswer = 3
        createPollResults(qansw, poll);
        createPollResults(qansw, poll);
        createPollResults(qansw, poll);
        createPollResults(qansw, poll);
        createPollResults(qansw, poll);
        createPollResults(qansw, poll);
        createPollResults(qansw, poll);

        final List<Object[]> pollsResultsbyAnswer = getPollDao().retrieveResultPollsbyAnswer(poll.getPollId(), qansw.getQuestionAnswerId());
        assertEquals("Should be equals", 1, pollsResultsbyAnswer.size());


        for (Object[] objects : pollsResultsbyAnswer) {
            if (objects[0] ==  qansw.getQuestionAnswerId()) {
                assertEquals("For answer1 should be equals",
                        objects[3], 7L);
            }
            if (objects[0] ==  qansw2.getQuestionAnswerId()) {
                assertEquals("For answer2 should be equals",
                        objects[3], 3L);
            }
        }
    }
View Full Code Here

     */
    @Test
    public void testGetTotalVotesByPollIdAndDateRange(){
        final Poll poll1 = createDefaultPoll(this.question, this.userAccount, this.initDate
                .minusHours(5).toDate(), 25L, 15L);
        final QuestionAnswer questionAnswer = createQuestionAnswer("maybe", this.question, "&93fak");
        final QuestionAnswer questionAnswer2 = createQuestionAnswer("yes", this.question, "jakP22");
        final QuestionAnswer questionAnswer3 = createQuestionAnswer("No", this.question, "Lmd93s");
        createPollResults(questionAnswer, poll1);
        createPollResults(questionAnswer2, poll1);
        createPollResults(questionAnswer3, poll1);
        final Long totalVotes = getPollDao().getTotalVotesByPollIdAndDateRange(poll1.getPollId(), SearchPeriods.SEVENDAYS);
        assertEquals("Should be equals", 3,
View Full Code Here

    public void testValidateVoteIP() {
        final String ip = "192.10.1.1";
        final String ip2 = "192.10.1.11";
        final Poll poll1 = createDefaultPoll(this.question, this.userAccount,
                this.initDate.minusHours(8).toDate());
        final QuestionAnswer qAsnwer = createQuestionAnswer("possible",
                this.question, "3fak34");
        createDefaultPollResults(qAsnwer, poll1, ip);

        final PollResult result = getPollDao().validateVoteIP(ip, poll1);
        assertNotNull(result);
View Full Code Here

  @Test
  public void testRetrieveAnswersbyQuestion() {
    final Question question1 = createDefaultQuestion(" Question 1");
    final Question question2 = createDefaultQuestion(" Question 2");
    final Question question3 = createDefaultQuestion(" Question 3");
    final QuestionAnswer qA1 = createDefaultQuestionAnswer("Yes", question1);
    final QuestionAnswer qA2 = createDefaultQuestionAnswer("No", question1);
    final QuestionAnswer qA3 = createDefaultQuestionAnswer("Maybe",
        question3);
    final QuestionAnswer qAnswer = getQuestionDaoImp()
        .retrieveAnswersByQuestionId(question1,
            qA2.getQuestionAnswerId());
    assertEquals(qA2.getAnswer(), qAnswer.getAnswer());
    final QuestionAnswer qAnswer1 = getQuestionDaoImp()
        .retrieveAnswersByQuestionId(question1,
            qA3.getQuestionAnswerId());
    assertNull(qAnswer1);

  }
View Full Code Here

     * Test to get total votes by tweetpoll and specific date range.
     */
    @Test
    public void testGetTotalVotesByTweetPollIdAndDateRange() {
        final Question myQuestion = createQuestion("Where are you from?", "");
        final QuestionAnswer qaAmerica = createQuestionAnswer("America",
                myQuestion, "123457");
        final QuestionAnswer qaEurope = createQuestionAnswer("Europa",
                myQuestion, "123469");
        final TweetPoll myTweetPoll = createPublishedTweetPoll(
                secondary.getAccount(), myQuestion);
        HashTag htCitizen = createHashTag("citizen");
        HashTag htCitizenShip = createHashTag("citizenship");
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.question.QuestionAnswer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.