### Question:
VfsLineageWriter implements ILineageWriter { protected FileObject getOutputDirectoryAsFile( LineageHolder holder ) { try { FileObject dateRootFolder = getDateFolder( holder ); dateRootFolder.createFolder(); String id = getNameForHolder( dateRootFolder, holder ); try { FileObject folder = dateRootFolder.resolveFile( id ); folder.createFolder(); if ( folder.isFile() ) { throw new IllegalStateException( Messages.getErrorString( "ERROR.OutputFolderWrongType", folder.getName() .getPath() ) ); } return folder; } catch ( Exception e ) { log.error( Messages.getErrorString( "ERROR.CouldNotCreateFile" ), e ); return null; } } catch ( Exception e ) { log.error( Messages.getErrorString( "ERROR.CouldNotCreateFile" ), e ); throw new IllegalStateException( e ); } } VfsLineageWriter(); @Override void outputExecutionProfile( LineageHolder holder ); @Override void outputLineageGraph( LineageHolder holder ); IGraphWriter getGraphWriter(); void setGraphWriter( IGraphWriter graphWriter ); String getOutputFolder(); static boolean isVFSPrefix( String prefix ); void setOutputFolder( String outputFolder ); @Override String getOutputStrategy(); @Override void setOutputStrategy( String strategy ); @Override void cleanOutput( LineageHolder holder ); static final String DEFAULT_OUTPUT_FOLDER; }### Answer:
@Test public void testGetOutputDirectoryAsFile() { holder.setId( "foobarbaz" ); FileObject fo = writer.getOutputDirectoryAsFile( holder ); assertThat( fo.getName().getPath(), endsWith( "foobarbaz" ) ); if ( !isWindows() ) { holder.setId( "transient:L1VzZXJzL21hdGNhbXBiZWxsL0Rvd25sb2Fkcy9Db25zdW1lckNvbXBsYWludHMua3Ry" + ":bG9jYWw6UHl0aG9uIEV4ZWN1dG9yIDI= - SQL - select " + "\"transient:L1VzZXJzL21hdGNhbXBiZWxsL0Rvd25sb2Fkcy9Db25zdW1lckNvbXBsYWludHMua3Ry:bG9jYW" ); fo = writer.getOutputDirectoryAsFile( holder ); assertThat( fo.getName().getPath(), endsWith( "transient-L1VzZXJzL21hdGNhbXBiZWxsL0Rvd25sb2Fkcy9Db25zdW1lckNvbXBsYWludHMua3Ry-bG9jYWw6UHl0aG9uIEV4ZWN1dG9yIDI= " + "- SQL - select \"transient-L1VzZXJzL21h" ) ); } holder.setId( "invalidChar % invalidChar" ); fo = writer.getOutputDirectoryAsFile( holder ); assertThat( fo.getName().getPath(), endsWith( "unknown_artifact" ) ); }