### Question:
TeacherToStudentCohortAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return EntityNames.STUDENT_COHORT_ASSOCIATION.equals(entityType) && isTeacher(); }  @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> validate(String entityType, Set<String> ids); @Override SecurityUtil.UserContext getContext();  }### Answer:
@Test public void testCanValidate() { setupCurrentUser(teacher1); Assert.assertTrue(validator.canValidate(EntityNames.STUDENT_COHORT_ASSOCIATION, false)); Assert.assertTrue(validator.canValidate(EntityNames.STUDENT_COHORT_ASSOCIATION, true)); injector.setStaffContext(); SecurityUtil.setUserContext(SecurityUtil.UserContext.STAFF_CONTEXT); Assert.assertFalse(validator.canValidate(EntityNames.STUDENT_COHORT_ASSOCIATION, false)); Assert.assertFalse(validator.canValidate(EntityNames.STUDENT_COHORT_ASSOCIATION, true)); }