diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayRequestAuthorizerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayRequestAuthorizerIntegrationTest.java index cec2b77631..c277785385 100644 --- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayRequestAuthorizerIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayRequestAuthorizerIntegrationTest.java @@ -1033,8 +1033,7 @@ class ApiGatewayRequestAuthorizerIntegrationTest { } private static void deleteFunctions(String... functionNames) throws Exception { - ExecutorService executor = Executors.newFixedThreadPool(functionNames.length); - try { + try (ExecutorService executor = Executors.newFixedThreadPool(functionNames.length)) { List> deletions = new ArrayList<>(); for (String functionName : functionNames) { deletions.add(executor.submit(() -> deleteFunction(functionName))); @@ -1042,8 +1041,6 @@ class ApiGatewayRequestAuthorizerIntegrationTest { for (Future deletion : deletions) { deletion.get(); } - } finally { - executor.shutdown(); } } diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiRequestAuthorizerTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiRequestAuthorizerTest.java index ebd5db6b58..0014b9f00a 100644 --- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiRequestAuthorizerTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiRequestAuthorizerTest.java @@ -746,8 +746,7 @@ class HttpApiRequestAuthorizerTest { } private static void deleteFunctions(String... functionNames) throws Exception { - ExecutorService executor = Executors.newFixedThreadPool(functionNames.length); - try { + try (ExecutorService executor = Executors.newFixedThreadPool(functionNames.length)) { List> deletions = new ArrayList<>(); for (String functionName : functionNames) { deletions.add(executor.submit(() -> deleteFunction(functionName))); @@ -755,8 +754,6 @@ class HttpApiRequestAuthorizerTest { for (Future deletion : deletions) { deletion.get(); } - } finally { - executor.shutdown(); } }