### Question:
GradebookEntryContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); Iterator<Entity> studentGradebookEntries = repo.findEach(EntityNames.STUDENT_GRADEBOOK_ENTRY, Query.query(Criteria.where("body.gradebookEntryId").is(entity.getEntityId()))); while(studentGradebookEntries.hasNext()) { Entity studentGradebookEntry = studentGradebookEntries.next(); edOrgs.addAll(studentResolver.findGoverningEdOrgs((String) studentGradebookEntry.getBody().get(ParameterConstants.STUDENT_ID), entity)); } return edOrgs; }  @Override Set<String> findGoverningEdOrgs(Entity entity);  }### Answer:
@Test public void test() { Entity gradebookEntry = Mockito.mock(Entity.class); Mockito.when(gradebookEntry.getEntityId()).thenReturn("123_id"); Mockito.when(gradebookEntry.getType()).thenReturn(EntityNames.GRADEBOOK_ENTRY); Entity sgbe1 = Mockito.mock(Entity.class); Map<String, Object> body1 = new HashMap<String, Object>(); body1.put(ParameterConstants.STUDENT_ID, "student1"); Mockito.when(sgbe1.getBody()).thenReturn(body1); Entity sgbe2 = Mockito.mock(Entity.class); Map<String, Object> body2 = new HashMap<String, Object>(); body2.put(ParameterConstants.STUDENT_ID, "student2"); Mockito.when(sgbe2.getBody()).thenReturn(body2); Mockito.when(repo.findEach(eq(EntityNames.STUDENT_GRADEBOOK_ENTRY), argThat(new BaseMatcher<Query>() { @Override public boolean matches(Object item) { Query q = (Query) item; return q.getQueryObject().get("body.gradebookEntryId").equals("123_id"); } @Override public void describeTo(Description description) { } }))).thenReturn(Arrays.asList(sgbe1, sgbe2).iterator()); Mockito.when(studentResolver.findGoverningEdOrgs("student1", gradebookEntry)).thenReturn(new HashSet<String>(Arrays.asList("lea1", "lea2"))); Mockito.when(studentResolver.findGoverningEdOrgs("student2", gradebookEntry)).thenReturn(new HashSet<String>(Arrays.asList("lea1", "lea3"))); Assert.assertEquals(new HashSet<String>(Arrays.asList("lea1", "lea2", "lea3")), resolver.findGoverningEdOrgs(gradebookEntry)); }