### Question:
MetadataService extends DatasourceService { public void removeMetadata( String metadataId ) throws PentahoAccessControlException { try { ensureDataAccessPermissionCheck(); } catch ( ConnectionServiceException e ) { throw new PentahoAccessControlException(); } metadataDomainRepository.removeDomain( forceXmiSuffix( metadataId ) ); } 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 testRemoveMetadata() throws Exception { doNothing().when( metadataService ).ensureDataAccessPermissionCheck(); doReturn( "param" ).when( metadataService ).fixEncodedSlashParam( "metadataId" ); doNothing().when( metadataService.metadataDomainRepository ).removeDomain( "param" ); metadataService.removeMetadata( "metadataId" ); verify( metadataService, times( 1 ) ).removeMetadata( "metadataId" ); verify( metadataService, never() ).fixEncodedSlashParam( "metadataId" ); }