### Question:
SectionEmbeddedDocsExtractor implements EntityDatedExtract { @SuppressWarnings("unchecked") @Override public void extractEntities(final EntityToEdOrgDateCache gradebookEntryCache) { Iterator<Entity> sections = this.repository.findEach(EntityNames.SECTION, new NeutralQuery()); while (sections.hasNext()) { Entity section = sections.next(); extractTeacherSectionAssociation(section); extractGradebookEntry(section, gradebookEntryCache); extractStudentSectionAssociation(section); } } SectionEmbeddedDocsExtractor(EntityExtractor entityExtractor, ExtractFileMap leaToExtractFileMap,
                                        Repository<Entity> repository, EntityToEdOrgDateCache studentCache,
                                        EntityToEdOrgDateCache staffDatedCache); @SuppressWarnings("unchecked") @Override void extractEntities(final EntityToEdOrgDateCache gradebookEntryCache); EntityToEdOrgDateCache getStudentSectionAssociationDateCache();  }### Answer:
@Test public void testExtractValidTSA() throws Exception { List<Entity> list = Arrays.asList(AccessibleVia.VALIDTSA.generate(), AccessibleVia.VALIDTSA.generate(), AccessibleVia.VALIDTSA.generate(), AccessibleVia.NONE.generate()); Mockito.when(repo.findEach(Mockito.eq(EntityNames.SECTION), Mockito.any(NeutralQuery.class))).thenReturn(list.iterator()); se.extractEntities(null); Mockito.verify(ex, Mockito.times(3)).extractEntity(Mockito.any(Entity.class), Mockito.any(ExtractFile.class), Mockito.eq(EntityNames.TEACHER_SECTION_ASSOCIATION)); }
@Test public void testExtractInvalidTSAs() throws Exception { List<Entity> list = Arrays.asList(AccessibleVia.INVALIDTSA.generate(), AccessibleVia.INVALIDTSA.generate(), AccessibleVia.INVALIDTSA.generate()); Mockito.when(repo.findEach(Mockito.eq(EntityNames.SECTION), Mockito.any(NeutralQuery.class))).thenReturn(list.iterator()); se.extractEntities(null); Mockito.verify(ex, Mockito.never()).extractEntity(Mockito.any(Entity.class), Mockito.any(ExtractFile.class), Mockito.eq(EntityNames.TEACHER_SECTION_ASSOCIATION)); }
@Test public void testExtractValidSSAs() throws Exception { List<Entity> list = Arrays.asList(AccessibleVia.VALIDSSA.generate(), AccessibleVia.VALIDSSA.generate(), AccessibleVia.VALIDSSA.generate(), AccessibleVia.NONE.generate()); Mockito.when(repo.findEach(Mockito.eq(EntityNames.SECTION), Mockito.any(NeutralQuery.class))).thenReturn(list.iterator()); se.extractEntities(null); Mockito.verify(ex, Mockito.times(3)).extractEntity(Mockito.any(Entity.class), Mockito.any(ExtractFile.class), Mockito.eq(EntityNames.STUDENT_SECTION_ASSOCIATION)); }
@Test public void testExtractInvalidSSAs() throws Exception { List<Entity> list = Arrays.asList(AccessibleVia.INVALIDSSA.generate(), AccessibleVia.INVALIDSSA.generate(), AccessibleVia.INVALIDSSA.generate()); Mockito.when(repo.findEach(Mockito.eq(EntityNames.SECTION), Mockito.any(NeutralQuery.class))).thenReturn(list.iterator()); se.extractEntities(null); Mockito.verify(ex, Mockito.never()).extractEntity(Mockito.any(Entity.class), Mockito.any(ExtractFile.class), Mockito.any(String.class)); }