Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for issue 2056 #2061

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}
Loading