### Question:
CsvImporter implements Importer { @Override public void doImport() throws IOException { FileSystemAbstraction fs = outsideWorld.fileSystem(); File storeDir = databaseConfig.get( GraphDatabaseSettings.database_path ); File reportFile = new File( reportFileName ); OutputStream badOutput = new BufferedOutputStream( fs.openAsOutputStream( reportFile, false ) ); Collector badCollector = badCollector( badOutput, isIgnoringSomething() ? BadCollector.UNLIMITED_TOLERANCE : 0, collect( ignoreBadRelationships, ignoreDuplicateNodes, ignoreExtraColumns ) ); Configuration configuration = new WrappedBatchImporterConfigurationForNeo4jAdmin( importConfiguration( null, false, databaseConfig, storeDir, highIO ) ); ZoneId dbTimeZone = databaseConfig.get( GraphDatabaseSettings.db_temporal_timezone ); Supplier<ZoneId> defaultTimeZone = () -> dbTimeZone; CsvInput input = new CsvInput( nodeData( inputEncoding, nodesFiles ), defaultFormatNodeFileHeader( defaultTimeZone ), relationshipData( inputEncoding, relationshipsFiles ), defaultFormatRelationshipFileHeader( defaultTimeZone ), idType, new WrappedCsvInputConfigurationForNeo4jAdmin( csvConfiguration( args, false ) ), badCollector, new CsvInput.PrintingMonitor( outsideWorld.outStream() ) ); ImportTool.doImport( outsideWorld.errorStream(), outsideWorld.errorStream(), outsideWorld.inStream(), DatabaseLayout.of( storeDir ), reportFile, fs, nodesFiles, relationshipsFiles, false, input, this.databaseConfig, badOutput, configuration, false ); } CsvImporter( Args args, Config databaseConfig, OutsideWorld outsideWorld ); @Override void doImport();  }### Answer:
@Test void writesReportToSpecifiedReportFile() throws Exception { File dbDir = testDir.directory( "db" ); File logDir = testDir.directory( "logs" ); File reportLocation = testDir.file( "the_report" ); File inputFile = testDir.file( "foobar.csv" ); List<String> lines = Collections.singletonList( "foo\\tbar\\tbaz" ); Files.write( inputFile.toPath(), lines, Charset.defaultCharset() ); try ( RealOutsideWorld outsideWorld = new RealOutsideWorld( System.out, System.err, new ByteArrayInputStream( new byte[0] ) ) ) { Config config = Config.builder() .withSettings( additionalConfig() ) .withSetting( GraphDatabaseSettings.database_path, dbDir.getAbsolutePath() ) .withSetting( GraphDatabaseSettings.logs_directory, logDir.getAbsolutePath() ).build(); CsvImporter csvImporter = new CsvImporter( Args.parse( String.format( "--report-file=%s", reportLocation.getAbsolutePath() ), String.format( "--nodes=%s", inputFile.getAbsolutePath() ), "--delimiter=TAB" ), config, outsideWorld ); csvImporter.doImport(); } assertTrue( reportLocation.exists() ); }