### Question:
StudentToSubStudentValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return SUB_STUDENT_ENTITIES.contains(entityType) && isStudentOrParent(); }  @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> validate(String entityType, Set<String> ids);  }### Answer:
@Test public void testCanValidate() { injector.setStudentContext(student1); assertTrue(validator.canValidate(EntityNames.ATTENDANCE, true)); assertTrue(validator.canValidate(EntityNames.ATTENDANCE, false)); assertTrue(validator.canValidate(EntityNames.STUDENT_ASSESSMENT, true)); assertTrue(validator.canValidate(EntityNames.STUDENT_ASSESSMENT, false)); assertTrue(validator.canValidate(EntityNames.STUDENT_GRADEBOOK_ENTRY, true)); assertTrue(validator.canValidate(EntityNames.STUDENT_GRADEBOOK_ENTRY, false)); assertTrue(validator.canValidate(EntityNames.GRADE, true)); assertTrue(validator.canValidate(EntityNames.GRADE, false)); assertTrue(validator.canValidate(EntityNames.STUDENT_ACADEMIC_RECORD, true)); assertTrue(validator.canValidate(EntityNames.STUDENT_ACADEMIC_RECORD, false)); assertTrue(validator.canValidate(EntityNames.REPORT_CARD, true)); assertTrue(validator.canValidate(EntityNames.REPORT_CARD, false)); assertTrue(validator.canValidate(EntityNames.STUDENT_SCHOOL_ASSOCIATION, true)); assertTrue(validator.canValidate(EntityNames.STUDENT_SCHOOL_ASSOCIATION, false)); assertFalse(validator.canValidate(EntityNames.STUDENT, false)); assertFalse(validator.canValidate(EntityNames.PARENT, true)); assertFalse(validator.canValidate(EntityNames.EDUCATION_ORGANIZATION, false)); assertFalse(validator.canValidate(EntityNames.STAFF, true)); assertFalse(validator.canValidate(EntityNames.DISCIPLINE_ACTION, false)); assertFalse(validator.canValidate(EntityNames.GRADUATION_PLAN, true)); assertFalse(validator.canValidate(EntityNames.PROGRAM, true)); }