Exemplo n.º 1
0
 @Test
 public void testGetQuestionsByCompanyWithOnlyCompanyName() {
   Company company = new Company();
   company.setName(this.company.getName());
   try {
     Question[] questions = service.getQuestionsByCompany(company);
     assert questions != null;
     assert questions.length == 2;
   } catch (TapWisdomException e) {
     e.printStackTrace();
     assert false;
   }
 }
Exemplo n.º 2
0
 @Test
 public void testUpdateQuestion() {
   Question question = questions.get(0);
   Question newQuestion = new Question();
   String newQStr = "What is the culture like?";
   newQuestion.setId(question.getId());
   newQuestion.setContent(newQStr);
   try {
     boolean updated = service.updateQuestion(newQuestion);
     assert updated == true;
     assert ((String) newQuestion.getContent()).equals(newQStr);
   } catch (TapWisdomException e) {
     e.printStackTrace();
     assert false;
   }
 }
Exemplo n.º 3
0
  @Before
  public void createQuestion() {
    questions = new ArrayList<Question>();

    company = new Company();
    company.setIndustry("IT");
    Location location = new Location();
    location.setName("bangalore");
    company.setLocations(new Location[] {location});
    company.setName("tapwisdom");
    try {
      companyDao.save(company);
    } catch (TapWisdomException e) {
      e.printStackTrace();
      assert false;
    }

    Question question = new Question();
    question.setCompanyId(company.getId());
    question.setContent("What is the question?");
    question.setTags("culture");
    question.setType(QuestionType.TEXT);
    questions.add(question);

    question = new Question();
    question.setCompanyId("fakeCompany");
    question.setContent("What is the question?");
    question.setTags("culture,technology");
    question.setIndustries(new String[] {"IT"});
    question.setType(QuestionType.TEXT);
    questions.add(question);
    try {
      for (Question q : questions) {
        questionDao.save(q);
      }
    } catch (TapWisdomException e) {
      e.printStackTrace();
      assert false;
    }
  }