@Test public void testGetQuestionsByCompanyWithExisting() { Company company = new Company(); company.setId(this.company.getId()); company.setIndustry(this.company.getIndustry()); try { Question[] questions = service.getQuestionsByCompany(company); assert questions != null; assert questions.length == 2; } catch (TapWisdomException e) { e.printStackTrace(); assert false; } }
@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; } }
@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; } }