Skip to content

Commit

Permalink
Make testLambdaCapturing conditional on GraalVM version
Browse files Browse the repository at this point in the history
Starting with GraalVM 24.0 lambda class names match the ones from
HotSpot.
  • Loading branch information
zakkak committed Nov 14, 2023
1 parent ee6f566 commit 4f6c97e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.DisableIfBuiltWithGraalVMNewerThan;
import io.quarkus.test.junit.DisableIfBuiltWithGraalVMOlderThan;
import io.quarkus.test.junit.GraalVMVersion;
import io.quarkus.test.junit.QuarkusIntegrationTest;
import io.restassured.RestAssured;

Expand Down Expand Up @@ -56,14 +59,21 @@ public void testTargetWithoutNested() {
}

@Test
public void testLambdaCapturing() {
final String resourceLambda = BASE_PKG + ".ResourceLambda";

@DisableIfBuiltWithGraalVMNewerThan(GraalVMVersion.GRAALVM_23_1_0)
public void testLambdaCapturingPre24_0() {
// Starting with GraalVM 22.1 support Lambda functions serialization
// (see https://github.com/oracle/graal/issues/3756)
RestAssured.given().when().get("/reflection/lambda").then().body(startsWith("Comparator$$Lambda$"));
}

@Test
@DisableIfBuiltWithGraalVMOlderThan(GraalVMVersion.GRAALVM_24_0_0)
public void testLambdaCapturingPost23_1() {
// Starting with GraalVM 24.0 lambda class names match the ones from HotSpot
// (see https://github.com/oracle/graal/pull/7775)
RestAssured.given().when().get("/reflection/lambda").then().body(startsWith("Comparator$$Lambda/"));
}

private void assertRegistration(String expected, String queryParam) {
RestAssured.given().queryParam("className", queryParam).when().get(ENDPOINT).then().body(is(expected));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import io.quarkus.deployment.pkg.steps.GraalVM;

public enum GraalVMVersion {
GRAALVM_23_1_0(GraalVM.Version.VERSION_23_1_0);
GRAALVM_23_1_0(GraalVM.Version.VERSION_23_1_0),
GRAALVM_24_0_0(GraalVM.Version.VERSION_24_0_0);

private final GraalVM.Version version;

Expand Down

0 comments on commit 4f6c97e

Please sign in to comment.