@Test(expectedExceptions = RuntimeException.class) public void ingestError() { Exception e = new RuntimeException(); when(fileStoreDownloadMock.downloadFile(url, identifier, entityName + ".csv")).thenThrow(e); fileIngester.ingest(entityName, url, "CSV", identifier, progress, "[email protected],[email protected]"); }
@Test public void ingest() { when(fileStoreDownloadMock.downloadFile(url, identifier, entityName + ".csv")).thenReturn(f); when(fileRepositoryCollectionFactoryMock.createFileRepositoryCollection(f)) .thenReturn(fileRepositoryCollectionMock); when(importServiceFactoryMock.getImportService(f, fileRepositoryCollectionMock)) .thenReturn(importServiceMock); when(importServiceMock.doImport( fileRepositoryCollectionMock, DatabaseAction.ADD_UPDATE_EXISTING, Package.DEFAULT_PACKAGE_NAME)) .thenReturn(report); fileIngester.ingest(entityName, url, "CSV", identifier, progress, "[email protected],[email protected]"); }