Package hibernate

Examples of hibernate.Answer


    }
  }
 
  @Test
  public void test02(){
    Answer answer = QuestionFactory.createAnswer("Love", 1, 1, false);
   
    Answer answerTester = new Answer("Love");
    answerTester.setSortOrder(1);
    answerTester.setQuestionId(1);
    answerTester.setIsCorrect(false);
   
    if (answerTester.getAnswerText().equals(answer.getAnswerText())){
     
    }
    else {
      Assert.fail("Answer text does not match");
    }
   
    if (answerTester.getSortOrder() == answer.getSortOrder()){
     
    }
    else {
      Assert.fail("Sort order does not match");
    }
   
    if (answerTester.getQuestionId() == answer.getQuestionId()) {
     
    }
    else {
      Assert.fail("Question id's do not match");
    }
   
    if (answerTester.isIsCorrect() == answer.isIsCorrect()){
     
    }
    else {
      Assert.fail("Is correct boolean values do not match");
    }
View Full Code Here


                         ObjectRetrievalTools<Answer> objTool3 = new ObjectRetrievalTools<Answer>();
                         List<Answer> answerList = objTool3.getObjectList(Table.Answer, "questionId", questionId);
                        
                         //delete all the answers from the db
                         for (Iterator<Answer> ansIterator = answerList.iterator(); ansIterator.hasNext();) {
                           Answer answerDelete = ansIterator.next();
                           myTools.dataRemoval(answerDelete);       
                         }
                    }
               }
                              
View Full Code Here

   * @param isCorrect
   * @return is the returned answer object
   */
  public static Answer createAnswer(String answerText, int sortOrder, int questionId,  boolean isCorrect){
   
    Answer answer = new Answer(answerText);
    answer.setSortOrder(sortOrder);
    answer.setQuestionId(questionId);
    answer.setIsCorrect(isCorrect);
   
    return answer;
  }
View Full Code Here

             
              //add question to the database
              int newQuestionID = myTools.dataEntry(questionObj);
       
              //set up answers
              Answer correct= QuestionFactory.createAnswer(correctAnswer, 1, newQuestionID, true);
              Answer wrong1 = QuestionFactory.createAnswer(answer2,     2, newQuestionID, false);
              Answer wrong2 = QuestionFactory.createAnswer(answer3,     3, newQuestionID, false);
              Answer wrong3 = QuestionFactory.createAnswer(answer4,     4, newQuestionID, false);

              // Now adding the answers to the database
              int correctAnswerId = myTools.dataEntry(correct);

              int answer2Id = myTools.dataEntry(wrong1);
View Full Code Here

                   
                    //add question to the database
                    int newQuestionID = myTools.dataEntry(questionObj);

                    // The logic to decide whether the correct answer is "True" or "False"
                    Answer trueAnswer, falseAnswer;
                   
                  // If the answer is true then "True" is true. If false, then "True" is false.
                  trueAnswer = QuestionFactory.createAnswer("True", 1, newQuestionID, answer);
                    falseAnswer = QuestionFactory.createAnswer("False", 2, newQuestionID, !answer);
               
View Full Code Here

TOP

Related Classes of hibernate.Answer

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.