### Question:
EntityWriterManager { public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; }  Entity write(Entity entity, ExtractFile archiveFile); void writeDeleteFile(Entity entity, ExtractFile archiveFile); void setWriters(DefaultHashMap<String, EntityWriter> writers); void setMultiFileEntities(Map<String, String> multiFileEntities); void setEntities(Map<String, String> entities);  }### Answer:
@Test public void testWrite() { ExtractFile archiveFile = Mockito.mock(ExtractFile.class); JsonFileWriter jsonFile = Mockito.mock(JsonFileWriter.class); Mockito.when(archiveFile.getDataFileEntry(Mockito.anyString())).thenReturn(jsonFile); Entity entity = Mockito.mock(Entity.class); Mockito.when(entity.getType()).thenReturn("teacher"); writer.write(entity, archiveFile); Mockito.verify(jsonWriter1, Mockito.times(1)).write(Mockito.any(Entity.class), Mockito.any(JsonFileWriter.class), Mockito.any(ErrorFile.class)); Mockito.verify(jsonWriter2, Mockito.times(1)).write(Mockito.any(Entity.class), Mockito.any(JsonFileWriter.class), Mockito.any(ErrorFile.class)); }
@Test public void testWriteDefault() { ExtractFile archiveFile = Mockito.mock(ExtractFile.class); JsonFileWriter jsonFile = Mockito.mock(JsonFileWriter.class); Mockito.when(archiveFile.getDataFileEntry(Mockito.anyString())).thenReturn(jsonFile); Entity entity = Mockito.mock(Entity.class); Mockito.when(entity.getType()).thenReturn("student"); writer.write(entity, archiveFile); Mockito.verify(defaultWriter, Mockito.times(1)).write(Mockito.any(Entity.class), Mockito.any(JsonFileWriter.class), Mockito.any(ErrorFile.class)); Mockito.verify(jsonWriter1, Mockito.times(0)).write(Mockito.any(Entity.class), Mockito.any(JsonFileWriter.class), Mockito.any(ErrorFile.class)); Mockito.verify(jsonWriter2, Mockito.times(0)).write(Mockito.any(Entity.class), Mockito.any(JsonFileWriter.class), Mockito.any(ErrorFile.class)); }