### Question:
VfsLineageCollector implements ILineageCollector { @Override public void compressArtifacts( List<String> paths, OutputStream os ) { ZipOutputStream zos = null; try { FileSystemOptions opts = new FileSystemOptions(); zos = new ZipOutputStream( os ); for ( String path : paths ) { FileObject file = KettleVFS.getFileObject( path, opts ); try { ZipEntry zipEntry = new ZipEntry( file.getName().getPath() ); zos.putNextEntry( zipEntry ); try ( InputStream fis = file.getContent().getInputStream() ) { zos.write( IOUtils.toByteArray( fis ) ); } } catch ( IOException e ) { log.error( Messages.getString( "ERROR.FailedAddingFileToZip", file.getName().getPath() ) ); } finally { try { zos.closeEntry(); } catch ( IOException e ) { log.error( Messages.getString( "ERROR.FailedToProperlyCloseZipEntry", file.getName().getPath() ) ); } } } } catch ( KettleFileException e ) { log.error( Messages.getString( "ERROR.UnexpectedVfsError", e.getMessage() ) ); } finally { IOUtils.closeQuietly( zos ); } } VfsLineageCollector(); String getOutputFolder(); void setOutputFolder( String outputFolder ); @Override List<String> listArtifacts(); @Override List<String> listArtifacts( final String startingDate ); @Override List<String> listArtifacts( final String startingDate, final String endingDate ); @Override List<String> listArtifactsForFile( String pathToArtifact ); @Override List<String> listArtifactsForFile( String pathToArtifact, String startingDate ); @Override List<String> listArtifactsForFile( String pathToArtifact, String startingDate, String endingDate ); @Override void compressArtifacts( List<String> paths, OutputStream os ); static final String DEFAULT_OUTPUT_FOLDER; }### Answer:
@Test public void testCompressArtifacts() throws Exception { List<String> artifacts = collector.listArtifacts(); File output = new File( "target/outputfiles/compressedFiles.zip" ); output.mkdirs(); if ( output.exists() ) { output.delete(); } FileOutputStream fos = spy( new FileOutputStream( output ) ); collector.compressArtifacts( artifacts, fos ); byte[] emptyByteArray = new byte[0]; verify( fos, atLeast( 6 ) ).write( any( emptyByteArray.getClass() ), anyInt(), anyInt() ); }