### Question:
GenericToGlobalBellScheduleWriteValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.BELL_SCHEDULE, entityType, ids)) { return Collections.emptySet(); } Set<String> edOrgLineage = getEdorgDescendents(getDirectEdorgs()); NeutralQuery classPeriodsQuery = new NeutralQuery(); classPeriodsQuery.addCriteria(new NeutralCriteria(ParameterConstants.EDUCATION_ORGANIZATION_ID, NeutralCriteria.CRITERIA_IN, edOrgLineage)); List<String> myClassPeriods = Lists.newArrayList(getRepo().findAllIds("classPeriod", classPeriodsQuery)); NeutralQuery bellSchedulesQuery = new NeutralQuery(); bellSchedulesQuery.addCriteria(new NeutralCriteria("meetingTime.classPeriodId", NeutralCriteria.CRITERIA_IN, myClassPeriods)); bellSchedulesQuery.addCriteria(new NeutralCriteria(ParameterConstants.ID, NeutralCriteria.CRITERIA_IN, ids, false)); Set<String> myBellSchedules = Sets.newHashSet(getRepo().findAllIds("bellSchedule", bellSchedulesQuery)); return myBellSchedules; }  @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> validate(String entityType, Set<String> ids); @Override SecurityUtil.UserContext getContext();  }### Answer:
@Test public void testFilterbellScheduleDataFromLEA() { setupStaff(staffLea, lea.getEntityId()); Set<String> expectedIds = new HashSet<String>(Arrays.asList(bellScheduleLea.getEntityId(), bellScheduleSchoolLea.getEntityId())); Set<String> actual = validator.validate(EntityNames.BELL_SCHEDULE, bellScheduleIds); Assert.assertEquals(expectedIds, actual); }
@Test public void testFilterClassPeriodDataFromSchool() { setupStaff(staffSchoolLea, schoolParentLea.getEntityId()); Set<String> expectedIds = new HashSet<String>(Arrays.asList(bellScheduleSchoolLea.getEntityId())); Set<String> actual = validator.validate(EntityNames.BELL_SCHEDULE, bellScheduleIds); Assert.assertEquals(expectedIds, actual); }
@Test public void testFilterClassPeriodDataFromSchool2() { setupStaff(staffSchoolNoParent, schoolNoParent.getEntityId()); Set<String> expectedIds = new HashSet<String>(Arrays.asList(bellScheduleSchoolNoParent.getEntityId())); Set<String> actual = validator.validate(EntityNames.BELL_SCHEDULE, bellScheduleIds); Assert.assertEquals(expectedIds, actual); }