diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml
index 79945f237..26bfc46f7 100644
--- a/.github/workflows/pr_build.yml
+++ b/.github/workflows/pr_build.yml
@@ -48,7 +48,7 @@ jobs:
strategy:
max-parallel: 5
matrix:
- java: [8, 11, 15, 16, 17, 18, 19, 20 ]
+ java: [8, 11, 15, 16, 17, 18, 19, 20, 21 ]
name: Java ${{ matrix.java }}
env:
JAVA: ${{ matrix.java }}
diff --git a/examples/powertools-examples-batch/pom.xml b/examples/powertools-examples-batch/pom.xml
index bbdc19b9f..99d3a97cc 100644
--- a/examples/powertools-examples-batch/pom.xml
+++ b/examples/powertools-examples-batch/pom.xml
@@ -105,6 +105,7 @@
shade
+ false
diff --git a/examples/powertools-examples-cloudformation/pom.xml b/examples/powertools-examples-cloudformation/pom.xml
index 01aedcaaf..c195cd262 100644
--- a/examples/powertools-examples-cloudformation/pom.xml
+++ b/examples/powertools-examples-cloudformation/pom.xml
@@ -130,6 +130,7 @@
shade
+ false
diff --git a/examples/powertools-examples-core/cdk/app/pom.xml b/examples/powertools-examples-core/cdk/app/pom.xml
index 57397f187..b4652bd65 100644
--- a/examples/powertools-examples-core/cdk/app/pom.xml
+++ b/examples/powertools-examples-core/cdk/app/pom.xml
@@ -51,13 +51,6 @@
log4j-api
${log4j.version}
-
-
- junit
- junit
- 4.13.2
- test
-
@@ -105,6 +98,7 @@
shade
+ false
diff --git a/examples/powertools-examples-core/cdk/app/src/test/java/helloworld/AppTest.java b/examples/powertools-examples-core/cdk/app/src/test/java/helloworld/AppTest.java
deleted file mode 100644
index 70dad8d71..000000000
--- a/examples/powertools-examples-core/cdk/app/src/test/java/helloworld/AppTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2023 Amazon.com, Inc. or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package helloworld;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
-import com.amazonaws.xray.AWSXRay;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class AppTest {
-
- @Before
- public void setup() {
- if (null == System.getenv("LAMBDA_TASK_ROOT")) {
- AWSXRay.beginSegment("test");
- }
- }
-
- @After
- public void tearDown() {
- if (AWSXRay.getCurrentSubsegmentOptional().isPresent()) {
- AWSXRay.endSubsegment();
- }
-
- if (null == System.getenv("LAMBDA_TASK_ROOT")) {
- AWSXRay.endSegment();
- }
- }
-
- @Test
- public void successfulResponse() {
- App app = new App();
- APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
- assertEquals(result.getStatusCode().intValue(), 200);
- assertEquals(result.getHeaders().get("Content-Type"), "application/json");
- String content = result.getBody();
- assertNotNull(content);
- assertTrue(content.contains("\"message\""));
- assertTrue(content.contains("\"hello world\""));
- assertTrue(content.contains("\"location\""));
- }
-}
diff --git a/examples/powertools-examples-core/gradle/build.gradle b/examples/powertools-examples-core/gradle/build.gradle
index e7367c246..06aec59e8 100644
--- a/examples/powertools-examples-core/gradle/build.gradle
+++ b/examples/powertools-examples-core/gradle/build.gradle
@@ -30,6 +30,5 @@ dependencies {
aspect 'software.amazon.lambda:powertools-tracing:1.17.0'
aspect 'software.amazon.lambda:powertools-logging:1.17.0'
aspect 'software.amazon.lambda:powertools-metrics:1.17.0'
- testImplementation 'junit:junit:4.13.2'
}
diff --git a/examples/powertools-examples-core/gradle/src/test/java/helloworld/AppTest.java b/examples/powertools-examples-core/gradle/src/test/java/helloworld/AppTest.java
deleted file mode 100644
index af3ec1275..000000000
--- a/examples/powertools-examples-core/gradle/src/test/java/helloworld/AppTest.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package helloworld;
-
-import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-public class AppTest {
- @Test
- public void successfulResponse() {
- App app = new App();
- APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
- assertEquals(200, result.getStatusCode().intValue());
- assertEquals("application/json", result.getHeaders().get("Content-Type"));
- String content = result.getBody();
- assertNotNull(content);
- assertTrue(content.contains("\"message\""));
- assertTrue(content.contains("\"hello world\""));
- assertTrue(content.contains("\"location\""));
- }
-}
diff --git a/examples/powertools-examples-core/sam/pom.xml b/examples/powertools-examples-core/sam/pom.xml
index 93c858556..997472344 100644
--- a/examples/powertools-examples-core/sam/pom.xml
+++ b/examples/powertools-examples-core/sam/pom.xml
@@ -51,13 +51,6 @@
log4j-api
${log4j.version}
-
-
- junit
- junit
- 4.13.2
- test
-
@@ -104,6 +97,7 @@
shade
+ false
diff --git a/examples/powertools-examples-core/sam/src/test/java/helloworld/AppTest.java b/examples/powertools-examples-core/sam/src/test/java/helloworld/AppTest.java
deleted file mode 100644
index 70dad8d71..000000000
--- a/examples/powertools-examples-core/sam/src/test/java/helloworld/AppTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2023 Amazon.com, Inc. or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package helloworld;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
-import com.amazonaws.xray.AWSXRay;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class AppTest {
-
- @Before
- public void setup() {
- if (null == System.getenv("LAMBDA_TASK_ROOT")) {
- AWSXRay.beginSegment("test");
- }
- }
-
- @After
- public void tearDown() {
- if (AWSXRay.getCurrentSubsegmentOptional().isPresent()) {
- AWSXRay.endSubsegment();
- }
-
- if (null == System.getenv("LAMBDA_TASK_ROOT")) {
- AWSXRay.endSegment();
- }
- }
-
- @Test
- public void successfulResponse() {
- App app = new App();
- APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
- assertEquals(result.getStatusCode().intValue(), 200);
- assertEquals(result.getHeaders().get("Content-Type"), "application/json");
- String content = result.getBody();
- assertNotNull(content);
- assertTrue(content.contains("\"message\""));
- assertTrue(content.contains("\"hello world\""));
- assertTrue(content.contains("\"location\""));
- }
-}
diff --git a/examples/powertools-examples-core/serverless/pom.xml b/examples/powertools-examples-core/serverless/pom.xml
index faa47c591..6fce1d2dd 100644
--- a/examples/powertools-examples-core/serverless/pom.xml
+++ b/examples/powertools-examples-core/serverless/pom.xml
@@ -51,13 +51,6 @@
log4j-api
${log4j.version}
-
-
- junit
- junit
- 4.13.2
- test
-
@@ -105,6 +98,7 @@
shade
+ false
diff --git a/examples/powertools-examples-core/serverless/src/test/java/helloworld/AppTest.java b/examples/powertools-examples-core/serverless/src/test/java/helloworld/AppTest.java
deleted file mode 100644
index 70dad8d71..000000000
--- a/examples/powertools-examples-core/serverless/src/test/java/helloworld/AppTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2023 Amazon.com, Inc. or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package helloworld;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
-import com.amazonaws.xray.AWSXRay;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class AppTest {
-
- @Before
- public void setup() {
- if (null == System.getenv("LAMBDA_TASK_ROOT")) {
- AWSXRay.beginSegment("test");
- }
- }
-
- @After
- public void tearDown() {
- if (AWSXRay.getCurrentSubsegmentOptional().isPresent()) {
- AWSXRay.endSubsegment();
- }
-
- if (null == System.getenv("LAMBDA_TASK_ROOT")) {
- AWSXRay.endSegment();
- }
- }
-
- @Test
- public void successfulResponse() {
- App app = new App();
- APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
- assertEquals(result.getStatusCode().intValue(), 200);
- assertEquals(result.getHeaders().get("Content-Type"), "application/json");
- String content = result.getBody();
- assertNotNull(content);
- assertTrue(content.contains("\"message\""));
- assertTrue(content.contains("\"hello world\""));
- assertTrue(content.contains("\"location\""));
- }
-}
diff --git a/examples/powertools-examples-core/terraform/pom.xml b/examples/powertools-examples-core/terraform/pom.xml
index 8da2780d8..2a55c31bc 100644
--- a/examples/powertools-examples-core/terraform/pom.xml
+++ b/examples/powertools-examples-core/terraform/pom.xml
@@ -51,13 +51,6 @@
log4j-api
${log4j.version}
-
-
- junit
- junit
- 4.13.2
- test
-
@@ -105,6 +98,7 @@
shade
+ false
diff --git a/examples/powertools-examples-core/terraform/src/test/java/helloworld/AppTest.java b/examples/powertools-examples-core/terraform/src/test/java/helloworld/AppTest.java
deleted file mode 100644
index 0ca4f264d..000000000
--- a/examples/powertools-examples-core/terraform/src/test/java/helloworld/AppTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2023 Amazon.com, Inc. or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package helloworld;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
-import org.junit.Test;
-
-public class AppTest {
-
- @Test
- public void successfulResponse() {
- App app = new App();
- APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
- assertEquals(result.getStatusCode().intValue(), 200);
- assertEquals(result.getHeaders().get("Content-Type"), "application/json");
- String content = result.getBody();
- assertNotNull(content);
- assertTrue(content.contains("\"message\""));
- assertTrue(content.contains("\"hello world\""));
- assertTrue(content.contains("\"location\""));
- }
-}
diff --git a/examples/powertools-examples-idempotency/pom.xml b/examples/powertools-examples-idempotency/pom.xml
index a98645a29..8cda4bfb3 100644
--- a/examples/powertools-examples-idempotency/pom.xml
+++ b/examples/powertools-examples-idempotency/pom.xml
@@ -64,30 +64,6 @@
log4j-api
${log4j.version}
-
-
- org.mockito
- mockito-core
- 4.11.0
- test
-
-
- org.junit.jupiter
- junit-jupiter-api
- 5.9.3
- test
-
-
- com.amazonaws
- DynamoDBLocal
- 1.22.0
- test
-
-
- com.amazonaws
- aws-lambda-java-tests
- 1.1.1
-
@@ -167,6 +143,7 @@
shade
+ false
diff --git a/examples/powertools-examples-idempotency/src/test/java/helloworld/AppTest.java b/examples/powertools-examples-idempotency/src/test/java/helloworld/AppTest.java
deleted file mode 100644
index 7f097906a..000000000
--- a/examples/powertools-examples-idempotency/src/test/java/helloworld/AppTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2023 Amazon.com, Inc. or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package helloworld;
-
-import com.amazonaws.services.dynamodbv2.local.main.ServerRunner;
-import com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer;
-import com.amazonaws.services.lambda.runtime.Context;
-import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
-import com.amazonaws.services.lambda.runtime.tests.EventLoader;
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.URI;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient;
-import software.amazon.awssdk.regions.Region;
-import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
-import software.amazon.awssdk.services.dynamodb.model.AttributeDefinition;
-import software.amazon.awssdk.services.dynamodb.model.BillingMode;
-import software.amazon.awssdk.services.dynamodb.model.CreateTableRequest;
-import software.amazon.awssdk.services.dynamodb.model.KeySchemaElement;
-import software.amazon.awssdk.services.dynamodb.model.KeyType;
-import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
-
-public class AppTest {
- private static DynamoDbClient client;
- @Mock
- private Context context;
- private App app;
-
- @BeforeAll
- public static void setupDynamoLocal() {
- int port = getFreePort();
- try {
- DynamoDBProxyServer dynamoProxy = ServerRunner.createServerFromCommandLineArgs(new String[] {
- "-inMemory",
- "-port",
- Integer.toString(port)
- });
- dynamoProxy.start();
- } catch (Exception e) {
- throw new RuntimeException();
- }
-
- client = DynamoDbClient.builder()
- .httpClient(UrlConnectionHttpClient.builder().build())
- .region(Region.EU_WEST_1)
- .endpointOverride(URI.create("http://localhost:" + port))
- .credentialsProvider(StaticCredentialsProvider.create(
- AwsBasicCredentials.create("FAKE", "FAKE")))
- .build();
-
- client.createTable(CreateTableRequest.builder()
- .tableName("idempotency")
- .keySchema(KeySchemaElement.builder().keyType(KeyType.HASH).attributeName("id").build())
- .attributeDefinitions(
- AttributeDefinition.builder().attributeName("id").attributeType(ScalarAttributeType.S).build()
- )
- .billingMode(BillingMode.PAY_PER_REQUEST)
- .build());
- }
-
- private static int getFreePort() {
- try {
- ServerSocket socket = new ServerSocket(0);
- int port = socket.getLocalPort();
- socket.close();
- return port;
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- }
-
- @BeforeEach
- void setUp() {
- MockitoAnnotations.openMocks(this);
- app = new App(client);
- }
-
- @Test
- public void testApp() {
- APIGatewayProxyResponseEvent response =
- app.handleRequest(EventLoader.loadApiGatewayRestEvent("event.json"), context);
- Assertions.assertNotNull(response);
- Assertions.assertTrue(response.getBody().contains("hello world"));
- }
-}
diff --git a/examples/powertools-examples-idempotency/src/test/resources/event.json b/examples/powertools-examples-idempotency/src/test/resources/event.json
deleted file mode 100644
index fd7f5ace7..000000000
--- a/examples/powertools-examples-idempotency/src/test/resources/event.json
+++ /dev/null
@@ -1,63 +0,0 @@
-{
- "body": "{\"address\": \"https://checkip.amazonaws.com\"}",
- "resource": "/{proxy+}",
- "path": "/path/to/resource",
- "httpMethod": "POST",
- "isBase64Encoded": false,
- "queryStringParameters": {
- "foo": "bar"
- },
- "pathParameters": {
- "proxy": "/path/to/resource"
- },
- "stageVariables": {
- "baz": "qux"
- },
- "headers": {
- "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
- "Accept-Encoding": "gzip, deflate, sdch",
- "Accept-Language": "en-US,en;q=0.8",
- "Cache-Control": "max-age=0",
- "CloudFront-Forwarded-Proto": "https",
- "CloudFront-Is-Desktop-Viewer": "true",
- "CloudFront-Is-Mobile-Viewer": "false",
- "CloudFront-Is-SmartTV-Viewer": "false",
- "CloudFront-Is-Tablet-Viewer": "false",
- "CloudFront-Viewer-Country": "US",
- "Host": "1234567890.execute-api.us-east-1.amazonaws.com",
- "Upgrade-Insecure-Requests": "1",
- "User-Agent": "Custom User Agent String",
- "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)",
- "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==",
- "X-Forwarded-For": "127.0.0.1, 127.0.0.2",
- "X-Forwarded-Port": "443",
- "X-Forwarded-Proto": "https"
- },
- "requestContext": {
- "accountId": "123456789012",
- "resourceId": "123456",
- "stage": "prod",
- "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
- "requestTime": "09/Apr/2015:12:34:56 +0000",
- "requestTimeEpoch": 1428582896000,
- "identity": {
- "cognitoIdentityPoolId": null,
- "accountId": null,
- "cognitoIdentityId": null,
- "caller": null,
- "accessKey": null,
- "sourceIp": "127.0.0.1",
- "cognitoAuthenticationType": null,
- "cognitoAuthenticationProvider": null,
- "userArn": null,
- "userAgent": "Custom User Agent String",
- "user": null
- },
- "path": "/prod/path/to/resource",
- "resourcePath": "/{proxy+}",
- "httpMethod": "POST",
- "apiId": "1234567890",
- "protocol": "HTTP/1.1"
- }
- }
-
\ No newline at end of file
diff --git a/examples/powertools-examples-parameters/pom.xml b/examples/powertools-examples-parameters/pom.xml
index deb9c6ba6..0e07b0cbb 100644
--- a/examples/powertools-examples-parameters/pom.xml
+++ b/examples/powertools-examples-parameters/pom.xml
@@ -33,26 +33,6 @@
aws-lambda-java-events
3.11.3
-
-
-
- org.mockito
- mockito-core
- 5.1.1
- test
-
-
- org.junit.jupiter
- junit-jupiter-api
- 5.9.3
- test
-
-
- org.junit.jupiter
- junit-jupiter-engine
- 5.9.3
- test
-
diff --git a/examples/powertools-examples-serialization/pom.xml b/examples/powertools-examples-serialization/pom.xml
index eee3e456a..495fe8b77 100644
--- a/examples/powertools-examples-serialization/pom.xml
+++ b/examples/powertools-examples-serialization/pom.xml
@@ -33,36 +33,10 @@
aws-lambda-java-events
3.11.3
-
-
-
- org.mockito
- mockito-core
- 4.11.0
- test
-
-
- org.junit.jupiter
- junit-jupiter-api
- 5.9.3
- test
-
-
- org.junit.jupiter
- junit-jupiter-engine
- 5.9.3
- test
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- 3.1.2
-
org.apache.maven.plugins
diff --git a/examples/powertools-examples-serialization/src/test/java/org/demo/serialization/APIGatewayRequestDeserializationFunctionTest.java b/examples/powertools-examples-serialization/src/test/java/org/demo/serialization/APIGatewayRequestDeserializationFunctionTest.java
deleted file mode 100644
index ec8cdbd33..000000000
--- a/examples/powertools-examples-serialization/src/test/java/org/demo/serialization/APIGatewayRequestDeserializationFunctionTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2023 Amazon.com, Inc. or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.demo.serialization;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import com.amazonaws.services.lambda.runtime.Context;
-import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
-import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-class APIGatewayRequestDeserializationFunctionTest {
-
- @Mock
- private Context context;
- private APIGatewayRequestDeserializationFunction deserializationFunction;
-
- @BeforeEach
- void setUp() {
- MockitoAnnotations.openMocks(this);
- deserializationFunction = new APIGatewayRequestDeserializationFunction();
- }
-
- @Test
- public void shouldReturnOkStatusWithProductId() {
- String body = "{\"id\":1234, \"name\":\"product\", \"price\":42}";
- APIGatewayProxyRequestEvent request = new APIGatewayProxyRequestEvent().withBody(body);
-
- APIGatewayProxyResponseEvent response = deserializationFunction.handleRequest(request, context);
-
- assertEquals(200, response.getStatusCode());
- assertEquals("Received request for productId: 1234", response.getBody());
- }
-}
\ No newline at end of file
diff --git a/examples/powertools-examples-serialization/src/test/java/org/demo/serialization/SQSEventDeserializationFunctionTest.java b/examples/powertools-examples-serialization/src/test/java/org/demo/serialization/SQSEventDeserializationFunctionTest.java
deleted file mode 100644
index b46af3052..000000000
--- a/examples/powertools-examples-serialization/src/test/java/org/demo/serialization/SQSEventDeserializationFunctionTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2023 Amazon.com, Inc. or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.demo.serialization;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import com.amazonaws.services.lambda.runtime.Context;
-import com.amazonaws.services.lambda.runtime.events.SQSEvent;
-import java.util.ArrayList;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-class SQSEventDeserializationFunctionTest {
-
- @Mock
- private Context context;
- private SQSEventDeserializationFunction deserializationFunction;
-
- @BeforeEach
- void setUp() {
- MockitoAnnotations.openMocks(this);
- deserializationFunction = new SQSEventDeserializationFunction();
- }
-
- @Test
- public void shouldReturnNumberOfReceivedMessages() {
- SQSEvent.SQSMessage message1 = messageWithBody("{ \"id\": 1234, \"name\": \"product\", \"price\": 42}");
- SQSEvent.SQSMessage message2 = messageWithBody("{ \"id\": 12345, \"name\": \"product5\", \"price\": 45}");
- SQSEvent event = new SQSEvent();
- event.setRecords(new ArrayList() {{
- add(message1);
- add(message2);
- }});
-
- String response = deserializationFunction.handleRequest(event, context);
-
- assertEquals("Number of received messages: 2", response);
- }
-
- private SQSEvent.SQSMessage messageWithBody(String body) {
- SQSEvent.SQSMessage record1 = new SQSEvent.SQSMessage();
- record1.setBody(body);
- return record1;
- }
-}
\ No newline at end of file
diff --git a/examples/powertools-examples-sqs/pom.xml b/examples/powertools-examples-sqs/pom.xml
index 889fe85da..0338fe7d9 100644
--- a/examples/powertools-examples-sqs/pom.xml
+++ b/examples/powertools-examples-sqs/pom.xml
@@ -103,6 +103,7 @@
shade
+ false
diff --git a/examples/powertools-examples-validation/pom.xml b/examples/powertools-examples-validation/pom.xml
index 29f52b33e..65628f6b2 100644
--- a/examples/powertools-examples-validation/pom.xml
+++ b/examples/powertools-examples-validation/pom.xml
@@ -42,36 +42,10 @@
aws-lambda-java-core
1.2.3
-
-
-
- org.mockito
- mockito-core
- 4.11.0
- test
-
-
- org.junit.jupiter
- junit-jupiter-api
- 5.9.3
- test
-
-
- org.junit.jupiter
- junit-jupiter-engine
- 5.9.3
- test
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- 3.1.2
-
dev.aspectj
aspectj-maven-plugin
diff --git a/examples/powertools-examples-validation/src/test/java/org/demo/validation/InboundValidationTest.java b/examples/powertools-examples-validation/src/test/java/org/demo/validation/InboundValidationTest.java
deleted file mode 100644
index d5e6de313..000000000
--- a/examples/powertools-examples-validation/src/test/java/org/demo/validation/InboundValidationTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2023 Amazon.com, Inc. or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.demo.validation;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-import com.amazonaws.services.lambda.runtime.Context;
-import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
-import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import software.amazon.lambda.powertools.validation.ValidationException;
-
-public class InboundValidationTest {
-
- @Mock
- private Context context;
- private InboundValidation inboundValidation;
-
- @BeforeEach
- void setUp() {
- MockitoAnnotations.openMocks(this);
- inboundValidation = new InboundValidation();
- }
-
- @Test
- public void shouldReturnOkStatusWhenInputIsValid() {
- String body = "{\n" +
- " \"id\": 43242,\n" +
- " \"name\": \"FooBar XY\",\n" +
- " \"price\": 258\n" +
- " }";
- APIGatewayProxyRequestEvent request = new APIGatewayProxyRequestEvent().withBody(body);
-
- APIGatewayProxyResponseEvent response = inboundValidation.handleRequest(request, context);
-
- assertEquals(200, response.getStatusCode());
- }
-
- @Test
- public void shouldThrowExceptionWhenRequestInInvalid() {
- String bodyWithMissedId = "{\n" +
- " \"name\": \"FooBar XY\",\n" +
- " \"price\": 258\n" +
- " }";
- APIGatewayProxyRequestEvent request = new APIGatewayProxyRequestEvent().withBody(bodyWithMissedId);
-
- assertThrows(ValidationException.class, () -> inboundValidation.handleRequest(request, context));
- }
-}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 823b09d61..e1a0c5a6c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -263,18 +263,6 @@
3.13.0
test
-
- org.mockito
- mockito-core
- 4.11.0
- test
-
-
- org.mockito
- mockito-inline
- 4.11.0
- test
-
org.aspectj
aspectjweaver
@@ -286,6 +274,12 @@
assertj-core
3.24.2
test
+
+
+ net.bytebuddy
+ byte-buddy
+
+
org.skyscreamer
@@ -544,6 +538,62 @@
+
+ olderThanJdk11
+
+ (,11)
+
+
+
+ 4.11.0
+
+
+
+ org.mockito
+ mockito-core
+ ${mockito.version}
+ test
+
+
+ org.mockito
+ mockito-inline
+ ${mockito.version}
+ test
+
+
+
+
+ newerThanJdk11
+
+ [11,)
+
+
+ 5.6.0
+
+
+
+
+ org.mockito
+ mockito-core
+ ${mockito.version}
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+
+ true
+
+
+
+
+
+
newerThanJdk8
diff --git a/powertools-batch/pom.xml b/powertools-batch/pom.xml
index 27bb33a42..0c59ce497 100644
--- a/powertools-batch/pom.xml
+++ b/powertools-batch/pom.xml
@@ -56,16 +56,6 @@
aws-lambda-java-tests
test
-
- org.mockito
- mockito-core
- test
-
-
- org.mockito
- mockito-inline
- test
-
\ No newline at end of file
diff --git a/powertools-cloudformation/pom.xml b/powertools-cloudformation/pom.xml
index 1347d95a3..f6cd822a6 100644
--- a/powertools-cloudformation/pom.xml
+++ b/powertools-cloudformation/pom.xml
@@ -97,11 +97,6 @@
junit-jupiter-params
test
-
- org.mockito
- mockito-core
- test
-
org.assertj
assertj-core
diff --git a/powertools-core/pom.xml b/powertools-core/pom.xml
index a5460031d..b848e9f79 100644
--- a/powertools-core/pom.xml
+++ b/powertools-core/pom.xml
@@ -86,11 +86,6 @@
commons-lang3
test
-
- org.mockito
- mockito-core
- test
-
org.aspectj
aspectjweaver
@@ -101,11 +96,6 @@
assertj-core
test
-
- org.mockito
- mockito-inline
- test
-
@@ -122,5 +112,4 @@
-
\ No newline at end of file
diff --git a/powertools-idempotency/pom.xml b/powertools-idempotency/pom.xml
index e89df47f7..9dfde1bd1 100644
--- a/powertools-idempotency/pom.xml
+++ b/powertools-idempotency/pom.xml
@@ -107,16 +107,6 @@
junit-pioneer
test
-
- org.mockito
- mockito-core
- test
-
-
- org.mockito
- mockito-inline
- test
-
org.apache.commons
commons-lang3
diff --git a/powertools-large-messages/pom.xml b/powertools-large-messages/pom.xml
index aed8cc2e4..8fdae2139 100644
--- a/powertools-large-messages/pom.xml
+++ b/powertools-large-messages/pom.xml
@@ -118,16 +118,6 @@
junit-pioneer
test
-
- org.mockito
- mockito-core
- test
-
-
- org.mockito
- mockito-inline
- test
-
org.apache.commons
commons-lang3
diff --git a/powertools-logging/pom.xml b/powertools-logging/pom.xml
index 26ad8c243..c31448e30 100644
--- a/powertools-logging/pom.xml
+++ b/powertools-logging/pom.xml
@@ -104,16 +104,6 @@
commons-lang3
test
-
- org.mockito
- mockito-core
- test
-
-
- org.mockito
- mockito-inline
- test
-
org.aspectj
aspectjweaver
diff --git a/powertools-metrics/pom.xml b/powertools-metrics/pom.xml
index cb3acf110..eff7296c8 100644
--- a/powertools-metrics/pom.xml
+++ b/powertools-metrics/pom.xml
@@ -104,16 +104,6 @@
commons-lang3
test
-
- org.mockito
- mockito-core
- test
-
-
- org.mockito
- mockito-inline
- test
-
org.aspectj
aspectjweaver
diff --git a/powertools-parameters/pom.xml b/powertools-parameters/pom.xml
index f99a3d3cd..808232ab1 100644
--- a/powertools-parameters/pom.xml
+++ b/powertools-parameters/pom.xml
@@ -120,16 +120,6 @@
junit-jupiter-engine
test
-
- org.mockito
- mockito-core
- test
-
-
- org.mockito
- mockito-inline
- test
-
org.apache.commons
commons-lang3
diff --git a/powertools-sqs/pom.xml b/powertools-sqs/pom.xml
index f824f409d..c4b2b54f0 100644
--- a/powertools-sqs/pom.xml
+++ b/powertools-sqs/pom.xml
@@ -115,11 +115,6 @@
commons-lang3
test
-
- org.mockito
- mockito-core
- test
-
org.aspectj
aspectjweaver
diff --git a/powertools-test-suite/pom.xml b/powertools-test-suite/pom.xml
index 55e713ec0..34e80b06e 100644
--- a/powertools-test-suite/pom.xml
+++ b/powertools-test-suite/pom.xml
@@ -100,11 +100,6 @@
commons-lang3
test
-
- org.mockito
- mockito-core
- test
-
org.aspectj
aspectjweaver
diff --git a/powertools-tracing/pom.xml b/powertools-tracing/pom.xml
index d2f14c3e0..d98a97e2a 100644
--- a/powertools-tracing/pom.xml
+++ b/powertools-tracing/pom.xml
@@ -105,16 +105,6 @@
commons-lang3
test
-
- org.mockito
- mockito-core
- test
-
-
- org.mockito
- mockito-inline
- test
-
org.aspectj
aspectjweaver
diff --git a/powertools-validation/pom.xml b/powertools-validation/pom.xml
index 606f02139..24de0ba2a 100644
--- a/powertools-validation/pom.xml
+++ b/powertools-validation/pom.xml
@@ -111,11 +111,6 @@
commons-lang3
test
-
- org.mockito
- mockito-core
- test
-
org.aspectj
aspectjweaver