Skip to content

Commit

Permalink
Add test for issue 2056 (#2061)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
timyates authored Feb 26, 2024
1 parent ad4a2d6 commit bd1d13b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions test-suite-aws-lambda-events-serde/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
}
dependencies {
testImplementation(projects.testSuiteAwsLambdaEvents)
testImplementation(projects.micronautFunctionAwsApiProxy)
testImplementation(mnSerde.micronaut.serde.jackson)
testImplementation(projects.micronautAwsLambdaEventsSerde)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package io.micronaut.aws.lambda.events.serde.tests;

import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
import io.micronaut.function.aws.proxy.MockLambdaContext;
import io.micronaut.function.aws.proxy.payload1.ApiGatewayProxyRequestEventFunction;
import io.micronaut.http.HttpMethod;
import io.micronaut.http.HttpStatus;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

class Issue2056Test {

private ApiGatewayProxyRequestEventFunction handler;

@BeforeEach
void setupSpec() {
handler = new ApiGatewayProxyRequestEventFunction();
}

@AfterEach
void cleanupSpec() throws Exception {
handler.close();
}

@Test
void testNotFoundEncoding() {
APIGatewayProxyRequestEvent request = new APIGatewayProxyRequestEvent();
request.setPath("/not_a_valid_url");
request.setHttpMethod(HttpMethod.GET.toString());
var response = handler.handleRequest(request, new MockLambdaContext());

assertEquals(HttpStatus.NOT_FOUND.getCode(), response.getStatusCode());
}
}

0 comments on commit bd1d13b

Please sign in to comment.