@Before public void beforeEveryMethodExecutes() throws Exception { for (int i = 0; i < RESEARCHES_COUNT; i++) { users.loginAsTeacher(); groupIds[i] = surveys.createGroup( group("group" + i).withEvaluator(EVALUATOR_EMAIL).withStudent(STUDENT_EMAIL)); users.loginAsEvaluator(); templateIds[i] = surveys.createTemplate(template("template" + i).withQuestions(openQuestion("question"))); surveys.createResearch(research().withSurvey(templateIds[i]).forGroup(groupIds[i])); } }
@Test public void studentShouldBeAbleToQueryPublishedTemplatesByGroupName() throws Exception { users.loginAsStudent(); whenQueriesPublishedTemplatesAsStudentWithKeyword("up2"); thenFollowingPublishedTemplatesAreRead(templateIds[2]); }
@Test public void studentShouldBeAbleToQueryPublishedTemplatesFromAllGroups() throws Exception { users.loginAsStudent(); whenQueriesAllGroupsForPublishedTemplatesAsStudent(); thenFollowingPublishedTemplatesAreRead(templateIds); }
@Test public void studentShouldBeAbleToQueryPublishedTemplatesFromMultipleGroups() throws Exception { users.loginAsStudent(); whenQueriesFollowingGroupsForPublishedTemplatesAsStudent(groupIds[1], groupIds[2]); thenFollowingPublishedTemplatesAreRead(templateIds[1], templateIds[2]); }
@Test public void evaluatorShouldBeAbleToQueryPublishedTemplatesFromAllHisGroups() throws Exception { users.loginAsEvaluator(); whenQueriesAllGroupsForPublishedTemplatesAsEvaluator(); thenFollowingPublishedTemplatesAreRead(templateIds); }
@Test public void evaluatorShouldBeAbleToQueryPublishedTemplatesFromMultipleGroups() throws Exception { users.loginAsEvaluator(); whenQueriesFollowingGroupsForPublishedTemplatesAsEvaluator(groupIds[0], groupIds[1]); thenFollowingPublishedTemplatesAreRead(templateIds[0], templateIds[1]); }