@Test public void noStudentSectionAssociation() { Entity studentCompetency = buildStudentCompetency(); when(repo.findById(EntityNames.STUDENT_SECTION_ASSOCIATION, "association123")).thenReturn(null); assertEquals(Collections.<String> emptySet(), underTest.findGoverningEdOrgs(studentCompetency)); }
@Override public Set<String> findGoverningEdOrgs(Entity entity) { if (entity == null) { return Collections.emptySet(); } String studentSectionAssociationId = (String) entity.getBody().get(ParameterConstants.STUDENT_SECTION_ASSOCIATION_ID); Entity studentSectionAssociation = repo.findById(EntityNames.STUDENT_SECTION_ASSOCIATION, studentSectionAssociationId); if (studentSectionAssociation == null) { return Collections.emptySet(); } String studentId = (String) studentSectionAssociation.getBody().get(ParameterConstants.STUDENT_ID); return studentResolver.findGoverningEdOrgs(studentId, entity); }
StudentCompetencyContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { if (entity == null) { return Collections.emptySet(); } String studentSectionAssociationId = (String) entity.getBody().get(ParameterConstants.STUDENT_SECTION_ASSOCIATION_ID); Entity studentSectionAssociation = repo.findById(EntityNames.STUDENT_SECTION_ASSOCIATION, studentSectionAssociationId); if (studentSectionAssociation == null) { return Collections.emptySet(); } String studentId = (String) studentSectionAssociation.getBody().get(ParameterConstants.STUDENT_ID); return studentResolver.findGoverningEdOrgs(studentId, entity); } }
StudentCompetencyContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { if (entity == null) { return Collections.emptySet(); } String studentSectionAssociationId = (String) entity.getBody().get(ParameterConstants.STUDENT_SECTION_ASSOCIATION_ID); Entity studentSectionAssociation = repo.findById(EntityNames.STUDENT_SECTION_ASSOCIATION, studentSectionAssociationId); if (studentSectionAssociation == null) { return Collections.emptySet(); } String studentId = (String) studentSectionAssociation.getBody().get(ParameterConstants.STUDENT_ID); return studentResolver.findGoverningEdOrgs(studentId, entity); }  }
StudentCompetencyContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { if (entity == null) { return Collections.emptySet(); } String studentSectionAssociationId = (String) entity.getBody().get(ParameterConstants.STUDENT_SECTION_ASSOCIATION_ID); Entity studentSectionAssociation = repo.findById(EntityNames.STUDENT_SECTION_ASSOCIATION, studentSectionAssociationId); if (studentSectionAssociation == null) { return Collections.emptySet(); } String studentId = (String) studentSectionAssociation.getBody().get(ParameterConstants.STUDENT_ID); return studentResolver.findGoverningEdOrgs(studentId, entity); }  @Override Set<String> findGoverningEdOrgs(Entity entity); }
StudentCompetencyContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { if (entity == null) { return Collections.emptySet(); } String studentSectionAssociationId = (String) entity.getBody().get(ParameterConstants.STUDENT_SECTION_ASSOCIATION_ID); Entity studentSectionAssociation = repo.findById(EntityNames.STUDENT_SECTION_ASSOCIATION, studentSectionAssociationId); if (studentSectionAssociation == null) { return Collections.emptySet(); } String studentId = (String) studentSectionAssociation.getBody().get(ParameterConstants.STUDENT_ID); return studentResolver.findGoverningEdOrgs(studentId, entity); }  @Override Set<String> findGoverningEdOrgs(Entity entity);  }