RepositoryPublishService { @Deprecated public void writeFile( String pathId, InputStream fileContents, Boolean overwriteFile ) throws PlatformImportException, PentahoAccessControlException { try { validateAccess(); } catch ( PentahoAccessControlException e ) { logger.error( e ); throw e; } IPlatformImportBundle bundle = buildBundle( pathId, fileContents, overwriteFile ); try { getPlatformImporter().importFile( bundle ); } catch ( PlatformImportException e ) { logger.error( e ); throw e; } catch ( Exception e ) { logger.error( e ); throw new InternalError(); } }  @Deprecated void writeFile( String pathId, InputStream fileContents, Boolean overwriteFile ); @Deprecated void publishFile( String pathId, InputStream fileContents, Boolean overwriteFile ); void publishFile( String pathId, InputStream fileContents, Optional<Properties> fileProperties );  }
@Test public void testWriteFile() throws Exception { String pathId = "path:to:file"; InputStream stubInputStream = IOUtils.toInputStream( "some test data for my input stream" ); Boolean overwriteFile = true; doReturn( true ).when( repositoryPublishService.policy ).isAllowed( anyString() ); doReturn( repositoryPublishService.policy ).when( repositoryPublishService ).getPolicy(); doReturn( mockRepositoryFileImportBundle ).when( repositoryPublishService ).buildBundle( pathId, stubInputStream, overwriteFile ); repositoryPublishService.writeFile( pathId, stubInputStream, overwriteFile ); verify( repositoryPublishService.platformImporter, times( 1 ) ).importFile( mockRepositoryFileImportBundle ); }