### Question:
StaffToSubStudentSectionAssociationEntityValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean through) { return isStaff() && isSubEntityOfStudentSectionAssociation(entityType); }  @Override boolean canValidate(String entityType, boolean through); @Override Set<String> validate(String entityType, Set<String> ids); @Override SecurityUtil.UserContext getContext();  }### Answer:
@Test public void testCanValidateStaffToGrade() throws Exception { assertTrue(validator.canValidate(EntityNames.GRADE, false)); assertTrue(validator.canValidate(EntityNames.GRADE, true)); }
@Test public void testCanValidateStaffToStudentCompetency() throws Exception { assertTrue(validator.canValidate(EntityNames.STUDENT_COMPETENCY, false)); assertTrue(validator.canValidate(EntityNames.STUDENT_COMPETENCY, true)); }
@Test public void testDeniedStaffToOtherEntity() throws Exception { assertFalse(validator.canValidate(EntityNames.STUDENT, false)); assertFalse(validator.canValidate(EntityNames.STUDENT, true)); assertFalse(validator.canValidate(EntityNames.STUDENT_COMPETENCY_OBJECTIVE, false)); assertFalse(validator.canValidate(EntityNames.STUDENT_COMPETENCY_OBJECTIVE, true)); }