### Question:
JSONExporter extends Exporter<T> { @Override public void exportStream(OutputStream outputStream, Iterator<T> iterator) throws IOException, ClassNotFoundException, IllegalAccessException { ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(outputStream, iterator); } JSONExporter(Class dataClass); @Override void exportStream(OutputStream outputStream, Iterator<T> iterator);  }### Answer:
@Test public void testExportStream() throws Exception { ByteArrayOutputStream os = new ByteArrayOutputStream(); JSONExporter<SamplePojo> exporter = new JSONExporter(SamplePojo.class); exporter.exportStream(os, TestData.getData().iterator()); os.flush(); os.close(); JSONImporter<SamplePojo> importer = new JSONImporter(SamplePojo.class); List<SamplePojo> list = importer.importStream(new ByteArrayInputStream(os.toByteArray())); assert list.size() == TestData.getData().size(); int index = 0; for (SamplePojo item : list) { SamplePojo ref = TestData.getData().get(index++); assertEquals(ref, item); } }