### Question:
MetadataService extends DatasourceService { public MetadataTempFilesListDto uploadMetadataFilesToTempDir( InputStream metadataFile, List<InputStream> localeFileStreams, List<String> localeFileNames ) throws Exception { String fileName = uploadFile( metadataFile ); MetadataTempFilesListDto dto = new MetadataTempFilesListDto(); dto.setXmiFileName( fileName ); logger.info( "metadata file uploaded: " + fileName ); if ( localeFileStreams != null && localeFileStreams.size() != 0 ) { List<MetadataTempFilesListBundleDto> bundles = new ArrayList<MetadataTempFilesListBundleDto>(); int cntr = 0; for ( InputStream inputStream : localeFileStreams ) { fileName = uploadFile( inputStream ); MetadataTempFilesListBundleDto bundle = new MetadataTempFilesListBundleDto( localeFileNames.get( cntr ), fileName ); bundles.add( bundle ); logger.info( "locale file uploaded: " + fileName ); cntr++; } dto.setBundles( bundles ); } return dto; } MetadataService(); static String getUploadDir(); void removeMetadata( String metadataId ); List<String> getMetadataDatasourceIds(); MetadataTempFilesListDto uploadMetadataFilesToTempDir( InputStream metadataFile,
      List<InputStream> localeFileStreams, List<String> localeFileNames ); MetadataTempFilesListDto uploadMetadataFilesToTempDir( InputStream metadataFile,
      List<FormDataBodyPart> localeFiles ); void importMetadataDatasource( String domainId, InputStream metadataFile,
                                        FormDataContentDisposition metadataFileInfo, boolean overwrite,
                                        List<FormDataBodyPart> localeFiles,
                                        List<FormDataContentDisposition> localeFilesInfo, RepositoryFileAclDto acl ); void importMetadataDatasource( String domainId, InputStream metadataFile, boolean overwrite,
      List<InputStream> localeFileStreams, List<String> localeFileNames, RepositoryFileAclDto acl ); boolean isContainsModel( String tempFileName ); void importMetadataFromTemp( String domainId, MetadataTempFilesListDto fileList,
      boolean overwrite, RepositoryFileAclDto acl ); RepositoryFileAclDto getMetadataAcl( String domainId ); void setMetadataAcl( String domainId, RepositoryFileAclDto aclDto ); static RepositoryFileImportBundle createNewRepositoryFileImportBundle( InputStream bais, String fileName, String domainId );  }### Answer:
@Test public void testUploadMetadataFilesToTempDir() throws Exception { InputStream metadataFile = mock( InputStream.class ); fillServiceMock( DOMAIN_ID, metadataFile ); doReturn( new StringInputStream( "" ) ).when( metadataService ).createInputStreamFromFile( any( String.class ) ); doReturn( XMI_TEMP_FILE_NAME ).when( metadataService ).uploadFile( any( InputStream.class ) ); MetadataTempFilesListDto res = metadataService.uploadMetadataFilesToTempDir( metadataFile, null, null ); assertEquals( res.getXmiFileName(), XMI_TEMP_FILE_NAME ); }