@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; } }
@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; } }
@Test(expected = TapWisdomException.class) public void testGetQuestionsByCompanyWithInvalidCompany() throws TapWisdomException { Company company = new Company(); company.setName("invalidName"); service.getQuestionsByCompany(company); }