Skip to content

Commit bd1d13b

Browse files
authored
Add test for issue 2056 (#2061)
When we add back `@SerdeImport(Object.class)` to aws-lambda-events-serde/src/main/java/io/micronaut/aws/lambda/events/serde/LambdaDestinationEventSerde.java, this test fails.
1 parent ad4a2d6 commit bd1d13b

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

test-suite-aws-lambda-events-serde/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
}
55
dependencies {
66
testImplementation(projects.testSuiteAwsLambdaEvents)
7+
testImplementation(projects.micronautFunctionAwsApiProxy)
78
testImplementation(mnSerde.micronaut.serde.jackson)
89
testImplementation(projects.micronautAwsLambdaEventsSerde)
910
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package io.micronaut.aws.lambda.events.serde.tests;
2+
3+
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
4+
import io.micronaut.function.aws.proxy.MockLambdaContext;
5+
import io.micronaut.function.aws.proxy.payload1.ApiGatewayProxyRequestEventFunction;
6+
import io.micronaut.http.HttpMethod;
7+
import io.micronaut.http.HttpStatus;
8+
import org.junit.jupiter.api.AfterEach;
9+
import org.junit.jupiter.api.BeforeEach;
10+
import org.junit.jupiter.api.Test;
11+
12+
import static org.junit.jupiter.api.Assertions.assertEquals;
13+
14+
class Issue2056Test {
15+
16+
private ApiGatewayProxyRequestEventFunction handler;
17+
18+
@BeforeEach
19+
void setupSpec() {
20+
handler = new ApiGatewayProxyRequestEventFunction();
21+
}
22+
23+
@AfterEach
24+
void cleanupSpec() throws Exception {
25+
handler.close();
26+
}
27+
28+
@Test
29+
void testNotFoundEncoding() {
30+
APIGatewayProxyRequestEvent request = new APIGatewayProxyRequestEvent();
31+
request.setPath("/not_a_valid_url");
32+
request.setHttpMethod(HttpMethod.GET.toString());
33+
var response = handler.handleRequest(request, new MockLambdaContext());
34+
35+
assertEquals(HttpStatus.NOT_FOUND.getCode(), response.getStatusCode());
36+
}
37+
}

0 commit comments

Comments
 (0)