RepositoryFileOutputStream extends ByteArrayOutputStream implements ISourcesStreamEvents { IRepositoryFileData convert( Converter converter, ByteArrayInputStream bis, String mimeType ) { final IRepositoryFileData payload; if ( converter != null ) { payload = converter.convert( bis, charsetName, mimeType ); } else { payload = new SimpleRepositoryFileData( bis, charsetName, mimeType ); } return payload; } RepositoryFileOutputStream( final String path, final boolean autoCreateUniqueFileName,
      final boolean autoCreateDirStructure, final IUnifiedRepository repository, final boolean hidden );  RepositoryFileOutputStream( final Serializable id, final boolean autoCreateUniqueFileName,
      final boolean autoCreateDirStructure, final IUnifiedRepository repository, final boolean hidden );  RepositoryFileOutputStream( final RepositoryFile file, final boolean autoCreateUniqueFileName,
      final boolean autoCreateDirStructure, final IUnifiedRepository repository );  RepositoryFileOutputStream( final String path, final boolean autoCreateUniqueFileName,
      final boolean autoCreateDirStructure );  RepositoryFileOutputStream( final Serializable id, final boolean autoCreateUniqueFileName,
      final boolean autoCreateDirStructure );  RepositoryFileOutputStream( final RepositoryFile file, final boolean autoCreateUniqueFileName,
      final boolean autoCreateDirStructure );  RepositoryFileOutputStream( final String path );  RepositoryFileOutputStream( final String path, final boolean hidden );  RepositoryFileOutputStream( final RepositoryFile file );  RepositoryFileOutputStream( final Serializable id ); protected  RepositoryFileOutputStream( String path, String charsetName ); protected  RepositoryFileOutputStream( RepositoryFile file, String charsetName ); protected  RepositoryFileOutputStream( Serializable id, String charsetName ); void forceFlush( boolean forceFlush ); @Override void flush(); @Override void close(); String getFilePath(); void setFilePath( String path ); boolean getAutoCreateUniqueFileName(); boolean getAutoCreateDirStructure(); void setAutoCreateDirStructure( boolean autoCreateDirStructure ); void addListener( IStreamListener listener ); void setRepository( final IUnifiedRepository repository ); IUnifiedRepository getRepository(); String getCharsetName(); void setCharsetName( final String charsetName ); boolean isFlushed();  }
@Test public void convertTest() throws Exception { RepositoryFileOutputStream spy = spy( new RepositoryFileOutputStream( "1.ktr", "UTF-8" ) ); Converter converter = Mockito.mock( Converter.class ); ByteArrayInputStream bis = Mockito.mock( ByteArrayInputStream.class ); Mockito.doReturn( Mockito.mock( NodeRepositoryFileData.class ) ).when( converter ).convert( bis, "UTF-8", "" ); IRepositoryFileData data = spy.convert( null, bis, "" ); assertTrue( data instanceof SimpleRepositoryFileData ); data = spy.convert( converter, bis, "" ); assertTrue( data instanceof NodeRepositoryFileData ); }