diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 468fac02..46d97234 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -13,9 +13,7 @@ jobs: matrix: java_version: - 11 - # Errors with `java.lang.IllegalArgumentException: ArquillianServletRunnerEE9 not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.` - # Bumping various Arquillian dependencies does not fix, leave as just Java 11 - # - 17 + - 21 steps: - name: Setup Java diff --git a/pom.xml b/pom.xml index b8b04abb..a4318e7c 100644 --- a/pom.xml +++ b/pom.xml @@ -126,7 +126,7 @@ org.jboss.arquillian arquillian-bom - 1.7.0.Final + 1.9.5.Final import pom @@ -153,14 +153,14 @@ 1.2.13 - junit - junit - 4.13.2 + org.junit.jupiter + junit-jupiter + 5.13.1 test - org.jboss.arquillian.junit - arquillian-junit-container + org.jboss.arquillian.junit5 + arquillian-junit5-container test @@ -208,13 +208,13 @@ org.omnifaces.arquillian arquillian-glassfish-server-embedded - 1.4 + 1.8 test org.glassfish.main.extras glassfish-embedded-all - 7.0.5 + 7.0.25 test @@ -242,9 +242,11 @@ GlassFish to retarget the derby log file --> maven-surefire-plugin - 2.19.1 + 3.5.3 - -Xmx768m -XX:MaxMetaspaceSize=256m + + --add-opens java.base/java.lang=ALL-UNNAMED + ${project.build.testOutputDirectory}/logging.properties diff --git a/src/test/java/org/icatproject/topcat/AdminResourceTest.java b/src/test/java/org/icatproject/topcat/AdminResourceTest.java index 885e8afe..f96043a0 100644 --- a/src/test/java/org/icatproject/topcat/AdminResourceTest.java +++ b/src/test/java/org/icatproject/topcat/AdminResourceTest.java @@ -1,41 +1,46 @@ package org.icatproject.topcat; -import java.util.*; +import java.net.URLEncoder; +import java.util.ArrayList; import java.util.Date; -import java.io.File; -import java.lang.reflect.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import jakarta.inject.Inject; +import jakarta.json.JsonObject; +import jakarta.ejb.EJB; +import jakarta.ws.rs.core.Response; import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit5.container.annotation.ArquillianTest; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; -import static org.junit.Assert.*; -import org.junit.*; -import org.junit.runner.RunWith; -import jakarta.inject.Inject; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; -import jakarta.json.*; -import jakarta.ws.rs.core.Response; -import jakarta.ejb.EJB; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.icatproject.topcat.httpclient.HttpClient; -import org.icatproject.topcat.domain.*; -import org.icatproject.topcat.exceptions.BadRequestException; +import org.icatproject.topcat.domain.Download; +import org.icatproject.topcat.domain.DownloadStatus; +import org.icatproject.topcat.domain.DownloadType; import org.icatproject.topcat.exceptions.ForbiddenException; - -import java.net.URLEncoder; - import org.icatproject.topcat.repository.CacheRepository; import org.icatproject.topcat.repository.ConfVarRepository; import org.icatproject.topcat.repository.DownloadRepository; import org.icatproject.topcat.repository.DownloadTypeRepository; import org.icatproject.topcat.web.rest.AdminResource; -import java.sql.*; - -@RunWith(Arquillian.class) +@ArquillianTest public class AdminResourceTest { /* @@ -71,12 +76,12 @@ public static JavaArchive createDeployment() { private static String adminSessionId; private static String nonAdminSessionId; - @BeforeClass + @BeforeAll public static void beforeAll() { TestHelpers.installTrustManager(); } - @Before + @BeforeEach public void setup() throws Exception { HttpClient httpClient = new HttpClient("https://localhost:8181/icat"); @@ -194,7 +199,7 @@ public void testDownloadAPI() throws Exception { downloads = (List) response.getEntity(); testDownload = findDownload(downloads, testDownload.getId()); - assertTrue(testDownload.getIsDeleted() != currentDeleted); + assertNotEquals(testDownload.getIsDeleted(), currentDeleted); // Test that getDownloadStatus() etc. produce an error response for a non-admin // user @@ -206,7 +211,6 @@ public void testDownloadAPI() throws Exception { + (String) response.getEntity()); fail("AdminResource.getDownloads did not raise exception for non-admin user"); } catch (ForbiddenException fe) { - assertTrue(true); } try { @@ -217,7 +221,6 @@ public void testDownloadAPI() throws Exception { + (String) response.getEntity()); fail("AdminResource.setDownloadStatus did not raise exception for non-admin user"); } catch (ForbiddenException fe) { - assertTrue(true); } try { @@ -228,7 +231,6 @@ public void testDownloadAPI() throws Exception { + (String) response.getEntity()); fail("AdminResource.deleteDownload did not raise exception for non-admin user"); } catch (ForbiddenException fe) { - assertTrue(true); } } finally { // Remove the test download from the repository @@ -308,7 +310,7 @@ public void testSetDownloadTypeStatus() throws Exception { if (dt != null) { System.out.println( "DEBUG: AdminRT final download type status is {" + dt.getDisabled() + "," + dt.getMessage() + "}"); - assertTrue(disabled != dt.getDisabled()); + assertNotEquals(disabled, dt.getDisabled()); assertEquals(message, dt.getMessage()); } @@ -322,7 +324,6 @@ public void testSetDownloadTypeStatus() throws Exception { + (String) response.getEntity()); fail("AdminResource.setDownloadTypeStatus did not raise exception for non-admin user"); } catch (ForbiddenException fe) { - assertTrue(true); } // Finally, ought to reset the disabled status to the original value! @@ -406,7 +407,6 @@ public void testClearCachedSize() throws Exception { + (String) response.getEntity()); fail("AdminResource.clearCachedSize did not raise exception for non-admin user"); } catch (ForbiddenException fe) { - assertTrue(true); } } @@ -437,7 +437,6 @@ public void testSetConfVar() throws Exception { + (String) response.getEntity()); fail("AdminResource.setConfVar did not raise exception for non-admin user"); } catch (ForbiddenException fe) { - assertTrue(true); } } diff --git a/src/test/java/org/icatproject/topcat/CacheRepositoryTest.java b/src/test/java/org/icatproject/topcat/CacheRepositoryTest.java index 55bc0f36..e05e5181 100644 --- a/src/test/java/org/icatproject/topcat/CacheRepositoryTest.java +++ b/src/test/java/org/icatproject/topcat/CacheRepositoryTest.java @@ -1,25 +1,22 @@ package org.icatproject.topcat; -import java.util.*; -import java.lang.reflect.*; +import jakarta.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit5.container.annotation.ArquillianTest; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; -import static org.junit.Assert.*; -import org.junit.*; -import org.junit.runner.RunWith; -import jakarta.inject.Inject; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; -import jakarta.ejb.EJB; +import org.junit.jupiter.api.Test; import org.icatproject.topcat.domain.Cache; import org.icatproject.topcat.repository.CacheRepository; -@RunWith(Arquillian.class) +@ArquillianTest public class CacheRepositoryTest { @Deployment @@ -44,6 +41,6 @@ public void testRemove() { String key = "test:remove"; cacheRepository.put(key, "Hello World"); cacheRepository.remove(key); - assertEquals(null,cacheRepository.get(key)); + assertNull(cacheRepository.get(key)); } -} \ No newline at end of file +} diff --git a/src/test/java/org/icatproject/topcat/FacilityMapTest.java b/src/test/java/org/icatproject/topcat/FacilityMapTest.java index e53ee175..14801cab 100644 --- a/src/test/java/org/icatproject/topcat/FacilityMapTest.java +++ b/src/test/java/org/icatproject/topcat/FacilityMapTest.java @@ -1,13 +1,14 @@ package org.icatproject.topcat; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.HashMap; import java.util.Map; import org.icatproject.topcat.exceptions.InternalException; -import org.junit.*; -import org.junit.function.ThrowingRunnable; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; public class FacilityMapTest { @@ -153,7 +154,7 @@ public void testGetIcatUrlFailure() throws InternalException{ FacilityMap facilityMap = new FacilityMap(props); - ThrowingRunnable runnable = () -> {facilityMap.getIcatUrl(null);}; + Executable runnable = () -> {facilityMap.getIcatUrl(null);}; assertThrows(InternalException.class, runnable); } } diff --git a/src/test/java/org/icatproject/topcat/IcatClientTest.java b/src/test/java/org/icatproject/topcat/IcatClientTest.java index 9003eb16..2b2e3015 100644 --- a/src/test/java/org/icatproject/topcat/IcatClientTest.java +++ b/src/test/java/org/icatproject/topcat/IcatClientTest.java @@ -1,25 +1,38 @@ package org.icatproject.topcat; -import java.util.*; -import java.lang.reflect.*; - -import static org.junit.Assert.*; -import org.junit.*; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; -import jakarta.json.*; -import jakarta.json.JsonValue.ValueType; import jakarta.ejb.EJB; +import jakarta.json.Json; +import jakarta.json.JsonArray; +import jakarta.json.JsonArrayBuilder; +import jakarta.json.JsonObject; +import jakarta.json.JsonObjectBuilder; +import jakarta.json.JsonValue; +import jakarta.json.JsonValue.ValueType; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.icatproject.topcat.httpclient.HttpClient; import org.icatproject.topcat.httpclient.Response; -import org.icatproject.topcat.domain.*; import org.icatproject.topcat.exceptions.TopcatException; - -import java.net.URLEncoder; - import org.icatproject.topcat.repository.CacheRepository; -import java.sql.*; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; public class IcatClientTest { @@ -30,12 +43,12 @@ public class IcatClientTest { private Connection connection; - @BeforeClass + @BeforeAll public static void beforeAll() { TestHelpers.installTrustManager(); } - @Before + @BeforeEach public void setup() throws Exception { HttpClient httpClient = new HttpClient("https://localhost:8181/icat"); String data = "json=" + URLEncoder.encode( diff --git a/src/test/java/org/icatproject/topcat/IdsClientTest.java b/src/test/java/org/icatproject/topcat/IdsClientTest.java index 9f7fe8f0..2d387ff8 100644 --- a/src/test/java/org/icatproject/topcat/IdsClientTest.java +++ b/src/test/java/org/icatproject/topcat/IdsClientTest.java @@ -1,10 +1,14 @@ package org.icatproject.topcat; -import java.util.*; -import java.lang.reflect.*; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; -import static org.junit.Assert.*; -import org.junit.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; public class IdsClientTest { @@ -54,16 +58,15 @@ public void testChunkOffsets() throws Exception { } allFound = allFound && foundInvestigation && foundDataset && foundDatafile; } - assertTrue("Not all IDs found in chunks", allFound); - assertTrue("At least one ID was repeated", ! foundRepeats); + assertTrue(allFound, "Not all IDs found in chunks"); + assertFalse(foundRepeats, "At least one ID was repeated"); } String expected = "test?investigationIds=1,2,3&datasetIds=4,5,6&datafileIds=7,8,9"; List offsets = (List) chunkOffsets.invoke(idsClient, "test?", generateIds(1, 3), generateIds(4, 3), generateIds(7, 3)); String actual = offsets.get(0); - assertTrue("expected: " + expected + " actual: " + actual, expected.equals(actual)); - + assertEquals(expected, actual); } @Test @@ -94,4 +97,4 @@ private boolean chunkContains(String chunk, String entityType, Long id) { return chunk.matches(".*" + entityType + "Ids=[\\d+,]*" + id.toString() + "[,\\d+]*.*"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/icatproject/topcat/PriorityMapTest.java b/src/test/java/org/icatproject/topcat/PriorityMapTest.java index 182fa164..341164cc 100644 --- a/src/test/java/org/icatproject/topcat/PriorityMapTest.java +++ b/src/test/java/org/icatproject/topcat/PriorityMapTest.java @@ -1,7 +1,7 @@ package org.icatproject.topcat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -10,8 +10,8 @@ import org.icatproject.topcat.exceptions.ForbiddenException; import org.icatproject.topcat.exceptions.InternalException; -import org.junit.Test; -import org.junit.function.ThrowingRunnable; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; public class PriorityMapTest { @Test @@ -73,7 +73,7 @@ public void testCheckAnonDownloadEnabled() throws NoSuchFieldException, Security Field field = PriorityMap.class.getDeclaredField("anonDownloadEnabled"); field.setAccessible(true); field.setBoolean(priorityMap, false); - ThrowingRunnable runnable = () -> {priorityMap.checkAnonDownloadEnabled("anon/anon");}; + Executable runnable = () -> {priorityMap.checkAnonDownloadEnabled("anon/anon");}; assertThrows(ForbiddenException.class, runnable); } } diff --git a/src/test/java/org/icatproject/topcat/StatusCheckTest.java b/src/test/java/org/icatproject/topcat/StatusCheckTest.java index 2f7d9a4f..3d33d61a 100644 --- a/src/test/java/org/icatproject/topcat/StatusCheckTest.java +++ b/src/test/java/org/icatproject/topcat/StatusCheckTest.java @@ -1,28 +1,35 @@ package org.icatproject.topcat; -import java.util.*; -import java.util.concurrent.TimeUnit; import java.io.IOException; +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import jakarta.inject.Inject; +import jakarta.ejb.EJB; import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit5.container.annotation.ArquillianTest; +import org.jboss.arquillian.transaction.api.annotation.Transactional; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.jboss.arquillian.transaction.api.annotation.Transactional; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.Assert.*; -import org.junit.*; -import org.junit.runner.RunWith; -import jakarta.inject.Inject; -import jakarta.ejb.EJB; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; -import org.icatproject.topcat.domain.*; +import org.icatproject.topcat.domain.Download; +import org.icatproject.topcat.domain.DownloadStatus; import org.icatproject.topcat.exceptions.TopcatException; import org.icatproject.topcat.repository.DownloadRepository; -@RunWith(Arquillian.class) +@ArquillianTest public class StatusCheckTest { @Deployment @@ -130,7 +137,7 @@ public boolean isPreparedWasCalled() { @Inject private StatusCheck statusCheck; - @BeforeClass + @BeforeAll public static void beforeAll() { TestHelpers.installTrustManager(); } @@ -860,9 +867,9 @@ public void testStartQueuedDownloadNonZeroRestoringDownload() throws Exception { Download postDownload2 = TestHelpers.getDummyDownload(downloadId2, downloadRepository); assertEquals(DownloadStatus.RESTORING, postDownload1.getStatus()); - assertNotNull("Expected RESTORING Download to still have preparedId set", postDownload1.getPreparedId()); + assertNotNull(postDownload1.getPreparedId(), "Expected RESTORING Download to still have preparedId set"); assertEquals(DownloadStatus.QUEUED, postDownload2.getStatus()); - assertNull("Expected QUEUED Download to not have preparedId set", postDownload2.getPreparedId()); + assertNull(postDownload2.getPreparedId(), "Expected QUEUED Download to not have preparedId set"); } finally { // clean up TestHelpers.deleteDummyDownload(downloadId1, downloadRepository); diff --git a/src/test/java/org/icatproject/topcat/TestHelpers.java b/src/test/java/org/icatproject/topcat/TestHelpers.java index 03a29997..ba8fc943 100644 --- a/src/test/java/org/icatproject/topcat/TestHelpers.java +++ b/src/test/java/org/icatproject/topcat/TestHelpers.java @@ -7,7 +7,6 @@ import org.icatproject.topcat.domain.Download; import org.icatproject.topcat.domain.DownloadItem; import org.icatproject.topcat.domain.DownloadStatus; -import org.icatproject.topcat.domain.EntityType; import org.icatproject.topcat.repository.DownloadRepository; import javax.net.ssl.HttpsURLConnection; diff --git a/src/test/java/org/icatproject/topcat/UserResourceTest.java b/src/test/java/org/icatproject/topcat/UserResourceTest.java index dd2e7c5f..4a3d64b2 100644 --- a/src/test/java/org/icatproject/topcat/UserResourceTest.java +++ b/src/test/java/org/icatproject/topcat/UserResourceTest.java @@ -1,45 +1,56 @@ package org.icatproject.topcat; -import java.util.*; -import java.io.File; -import java.lang.reflect.*; +import java.net.MalformedURLException; +import java.net.URLEncoder; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; + +import jakarta.ejb.EJB; +import jakarta.inject.Inject; +import jakarta.json.JsonArray; +import jakarta.json.JsonNumber; +import jakarta.json.JsonObject; +import jakarta.ws.rs.core.Response; import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit5.container.annotation.ArquillianTest; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; -import static org.junit.Assert.*; -import org.junit.*; -import org.junit.function.ThrowingRunnable; -import org.junit.runner.RunWith; -import jakarta.inject.Inject; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; -import jakarta.json.*; -import jakarta.ws.rs.core.Response; -import jakarta.ejb.EJB; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; import org.icatproject.topcat.httpclient.HttpClient; -import org.icatproject.topcat.domain.*; +import org.icatproject.topcat.domain.Cart; +import org.icatproject.topcat.domain.Download; +import org.icatproject.topcat.domain.DownloadStatus; import org.icatproject.topcat.exceptions.BadRequestException; import org.icatproject.topcat.exceptions.ForbiddenException; import org.icatproject.topcat.exceptions.NotFoundException; import org.icatproject.topcat.exceptions.TopcatException; - -import java.net.MalformedURLException; -import java.net.URLEncoder; - import org.icatproject.topcat.repository.CacheRepository; import org.icatproject.topcat.repository.CartRepository; import org.icatproject.topcat.repository.DownloadRepository; import org.icatproject.topcat.repository.DownloadTypeRepository; import org.icatproject.topcat.web.rest.UserResource; -import java.sql.*; -import java.text.ParseException; - -@RunWith(Arquillian.class) +@ArquillianTest public class UserResourceTest { /* @@ -74,22 +85,18 @@ public static JavaArchive createDeployment() { private static String sessionId; - private Connection connection; - - @BeforeClass + @BeforeAll public static void beforeAll() { TestHelpers.installTrustManager(); } - @Before + @BeforeEach public void setup() throws Exception { HttpClient httpClient = new HttpClient("https://localhost:8181/icat"); String loginData = "json=" + URLEncoder.encode( "{\"plugin\":\"simple\", \"credentials\":[{\"username\":\"root\"}, {\"password\":\"pw\"}]}", "UTF8"); String response = httpClient.post("session", new HashMap(), loginData).toString(); sessionId = Utils.parseJsonObject(response).getString("sessionId"); - - connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/icatdb", "icatdbuser", "icatdbuserpw"); } @Test @@ -97,7 +104,7 @@ public void testLogin() throws Exception { String loginResponseString = userResource.login(null, "root", "pw", null); JsonObject loginResponseObject = Utils.parseJsonObject(loginResponseString); - assertEquals(loginResponseObject.toString(), 1, loginResponseObject.keySet().size()); + assertEquals(1, loginResponseObject.keySet().size(), loginResponseObject.toString()); assertTrue(loginResponseObject.containsKey("sessionId")); // Will throw if not a UUID UUID.fromString(loginResponseObject.getString("sessionId")); @@ -228,7 +235,7 @@ public void testSubmitCart() throws Exception { assertEquals(transport, newDownload.getTransport()); // Email is slightly fiddly: if (email.equals("")) { - assertEquals(null, newDownload.getEmail()); + assertNull(newDownload.getEmail()); } else { assertEquals(email, newDownload.getEmail()); } @@ -324,7 +331,7 @@ public void testQueueVisitIdBadRequest() throws Exception { String facilityName = "LILS"; String transport = "http"; String email = ""; - ThrowingRunnable runnable = () -> userResource.queueVisitId(facilityName, sessionId, transport, null, email, null); + Executable runnable = () -> userResource.queueVisitId(facilityName, sessionId, transport, null, email, null); Throwable throwable = assertThrows(BadRequestException.class, runnable); assertEquals("(400) : visitId must be provided", throwable.getMessage()); @@ -340,7 +347,7 @@ public void testQueueVisitIdNotFound() throws Exception { String transport = "http"; String email = ""; String visitId = "test"; - ThrowingRunnable runnable = () -> userResource.queueVisitId(facilityName, sessionId, transport, null, email, visitId); + Executable runnable = () -> userResource.queueVisitId(facilityName, sessionId, transport, null, email, visitId); Throwable throwable = assertThrows(NotFoundException.class, runnable); assertEquals("(404) : No Datasets found for " + visitId, throwable.getMessage()); } @@ -392,7 +399,7 @@ public void testQueueFilesBadRequestEmpty() throws Exception { String facilityName = "LILS"; String transport = "http"; String email = ""; - ThrowingRunnable runnable = () -> userResource.queueFiles(facilityName, sessionId, transport, null, email, null); + Executable runnable = () -> userResource.queueFiles(facilityName, sessionId, transport, null, email, null); Throwable throwable = assertThrows(BadRequestException.class, runnable); assertEquals("(400) : At least one Datafile.location required", throwable.getMessage()); @@ -408,7 +415,7 @@ public void testQueueFilesBadRequestTooMany() throws Exception { String transport = "http"; String email = ""; List files = List.of("1", "2", "3", "4"); - ThrowingRunnable runnable = () -> userResource.queueFiles(facilityName, sessionId, transport, null, email, files); + Executable runnable = () -> userResource.queueFiles(facilityName, sessionId, transport, null, email, files); Throwable throwable = assertThrows(BadRequestException.class, runnable); assertEquals("(400) : Limit of 3 files exceeded", throwable.getMessage()); } @@ -419,7 +426,7 @@ public void testQueueFilesNotFound() throws Exception { String facilityName = "LILS"; String transport = "http"; String email = ""; - ThrowingRunnable runnable = () -> userResource.queueFiles(facilityName, sessionId, transport, null, email, List.of("test")); + Executable runnable = () -> userResource.queueFiles(facilityName, sessionId, transport, null, email, List.of("test")); Throwable throwable = assertThrows(NotFoundException.class, runnable); assertEquals("(404) : No Datafiles found", throwable.getMessage()); } @@ -496,7 +503,7 @@ public void testGetDownloadTypeStatus() throws Exception { @Test public void testGetDownloadStatusesBadRequest() throws MalformedURLException, TopcatException, ParseException { - ThrowingRunnable runnable = () -> userResource.getDownloadStatuses("LILS", sessionId, new ArrayList<>()); + Executable runnable = () -> userResource.getDownloadStatuses("LILS", sessionId, new ArrayList<>()); assertThrows(BadRequestException.class, runnable); } @@ -508,7 +515,7 @@ public void testGetDownloadNotFound() throws MalformedURLException, TopcatExcept DownloadStatus.COMPLETE, false, downloadRepository); downloadIds.add(download.getId()); - ThrowingRunnable runnable = () -> userResource.getDownloadStatuses("LILS", sessionId, downloadIds); + Executable runnable = () -> userResource.getDownloadStatuses("LILS", sessionId, downloadIds); assertThrows(NotFoundException.class, runnable); } finally { downloadIds.forEach(downloadId -> {