Example #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;
   }
 }
Example #2
0
 @Test
 public void testGetQuestionsByCompanyWithTags() {
   Company company = new Company();
   company.setId(this.company.getId());
   company.setIndustry(this.company.getIndustry());
   try {
     Map<String, List<Question>> questions = service.getQuestionsByCompanyWithTags(company);
     assert questions != null;
     assert questions.get("technology").size() == 1;
     assert questions.get("culture").size() == 2;
   } catch (TapWisdomException e) {
     assert false;
   }
 }
Example #3
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;
   }
 }
Example #4
0
 @Test(expected = TapWisdomException.class)
 public void testGetQuestionsByCompanyWithNonExisting() throws TapWisdomException {
   Company company = new Company();
   company.setId("company2");
   Question[] questions = service.getQuestionsByCompany(company);
 }
Example #5
0
 @Test(expected = TapWisdomException.class)
 public void testGetQuestionsByCompanyWithInvalidCompany() throws TapWisdomException {
   Company company = new Company();
   company.setName("invalidName");
   service.getQuestionsByCompany(company);
 }