Package org.encuestame.persistence.domain.question

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


        getTweetPoll().saveOrUpdate(myTweet);

        // Add 2 answers by question
        for (j = 0; j < 2; j++) {
            // Creating answers... - Select answers = "yes", "no", "maybe", "impossible", "never"
            final QuestionAnswer qAnswers = this.createRandomQuestionAnswer(j, question, answers);

            // Creating TweetPoll switch.
            TweetPollSwitch tpollSwitch = createTweetPollSwitch(qAnswers, myTweet);
            tpollSwitchList.add(tpollSwitch);
        }
View Full Code Here


     * @throws NoSuchAlgorithmException
     */
    private QuestionAnswer createRandomQuestionAnswer(final Integer j,
            final Question question, final String answers[])
            throws NoSuchAlgorithmException, UnsupportedEncodingException {
        final QuestionAnswer qAnswers = createQuestionAnswer(
                answers[1], question,
                MD5Utils.md5(RandomStringUtils.randomAlphanumeric(4) + j));
        return qAnswers;
    }
View Full Code Here

                getSpringSecurityLoggedUserAccount(), Boolean.TRUE, Boolean.TRUE);
        myPoll.getHashTags().add(tag);
        getPollDao().saveOrUpdate(myPoll);
        for (j = 0; j < 2; j++) {
            // Creating answers...
            final QuestionAnswer qAnswers = this.createRandomQuestionAnswer(j,
                    pollQuestion, answers);
            qAnswersList.add(qAnswers);
        }
        if (voteItem) {
            this.votePollResult(EnMeUtils.ipGenerator(),
View Full Code Here

   */
  @Test
  public void testGetPollByAnswerId() throws EnMeNoResultsFoundException {
    final Question q = createDefaultQuestion("question 1");
    final Question q1 = createDefaultQuestion("question 2");
    final QuestionAnswer a = createQuestionAnswer("Yes", q, "1234DF");
    final QuestionAnswer a1 = createQuestionAnswer("No", q, "5678MG");
    final QuestionAnswer a2 = createQuestionAnswer("Maybe", q1, "9101112");
    final Poll p = createDefaultPoll(q, userAccount);

    final Poll mp = this.pollService.getPollByAnswerId(p.getPollId(),
        a.getQuestionAnswerId(), null);
    Assert.assertNotNull(mp);
View Full Code Here

   */
  @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");
      }
    }

View Full Code Here

     * @throws EnMeExpcetion
     */
    @Test
    public void testUpdateAnswersByAnswerId() throws EnMeExpcetion{
        final String expectedResponse = "Quizas";
        final QuestionAnswer questionAnswers = createQuestionAnswer("No", this.question, "HASH");
        surveyService.updateAnswerByAnswerId(questionAnswers.getQuestionAnswerId(), expectedResponse);
        assertEquals(questionAnswers.getAnswer(), expectedResponse);
    }
View Full Code Here

    final Question question1 = createQuestion("Why the sea is salad?",
        "html");
    final TweetPoll tp = createTweetPollPublicated(true, true, new Date(),
        this.userAccount, question1);
    final QuestionAnswer qA = createQuestionAnswer("string", question1,
        "JDKSLD");
    final QuestionAnswer qB = createQuestionAnswer("string", question1,
        "JDKSELD");
    final QuestionAnswer qC = createQuestionAnswer("string", question1,
        "JDFSELD");
    final TweetPollSwitch tpswith = createTweetPollSwitch(qA, tp);
    final TweetPollSwitch tpswith2 = createTweetPollSwitch(qB, tp);
    final TweetPollSwitch tpswith3 = createTweetPollSwitch(qC, tp);
    List<TweetPollSwitch> tpSwitch = getTweetPollService()
View Full Code Here

  public void testGetTweetPollTotalVotes() {
    final Question question1 = createQuestion("Why the sea is salad?",
        "html");
    final TweetPoll tp = createTweetPollPublicated(true, true, new Date(),
        this.userAccount, question1);
    final QuestionAnswer qA = createQuestionAnswer("YES", question1,
        "JDKSLD");
    final QuestionAnswer qB = createQuestionAnswer("NO", question1,
        "JDKSSLD");
    final QuestionAnswer qC = createQuestionAnswer("NO", question1,
        "JDKSZLD");
    final TweetPollSwitch tps1 = createTweetPollSwitch(qA, tp);
    final TweetPollSwitch tps2 = createTweetPollSwitch(qB, tp);
    final TweetPollSwitch tps3 = createTweetPollSwitch(qC, tp);
    createTweetPollResult(tps1, "192.1.1.1");
View Full Code Here

    getTweetPoll().saveOrUpdate(tweetPoll1);

    // Create QuestionsAnswers
    final TweetPoll myTweetpoll = tweetPoll1;

    final QuestionAnswer questAns1 = createQuestionAnswer("yes",
        myFirstQuestion, "1234555");
    final QuestionAnswer questAns2 = createQuestionAnswer("no",
        myFirstQuestion, "12346666");
    final QuestionAnswer questAns3 = createQuestionAnswer("no",
        myFirstQuestion, "123466667");

    // Tweetpoll switch
    final TweetPollSwitch tps1 = createTweetPollSwitch(questAns1,
        tweetPoll1);
View Full Code Here

        final Question question2 = addQuestionSection("Second Question", section, this.user);
        Assert.assertNotNull(question);
        Assert.assertNotNull(question2);

        // 5- Add answer to the questions.
        final QuestionAnswer answerYes = createQuestionAnswer("Yes", question, "123");
        final QuestionAnswer answerNo = createQuestionAnswer("No", question, "456");
        final QuestionAnswer answerText = createQuestionAnswer("125", question2, "678");
        Assert.assertNotNull(answerYes);
        Assert.assertNotNull(answerNo);
        Assert.assertNotNull(answerText);

        // 6- Answer the survey.
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.