diff --git a/integration-tests/src/main/java/rest/Application.java b/integration-tests/src/main/java/rest/Application.java index b1bc816..f556a88 100644 --- a/integration-tests/src/main/java/rest/Application.java +++ b/integration-tests/src/main/java/rest/Application.java @@ -15,6 +15,7 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.core.MediaType; +import org.hibernate.validator.constraints.Length; import org.jboss.resteasy.reactive.RestForm; import org.jboss.resteasy.reactive.RestPath; import org.jboss.resteasy.reactive.RestQuery; @@ -103,6 +104,12 @@ public TemplateInstance validatedAction(@RestForm @NotBlank String required, return Templates.validatedForm(); } + @POST + public String withLengthValidation(@RestForm("foo") @Length(min = 2, max = 4) String param) { + return "Got 'foo' param: " + param + ", has errors: " + validation.hasErrors() + ", 'foo' error: " + + validation.getError("foo"); + } + @Path("/absolute") public String absolutePath() { return "Absolute"; diff --git a/integration-tests/src/test/java/io/quarkiverse/renarde/it/RenardeResourceTest.java b/integration-tests/src/test/java/io/quarkiverse/renarde/it/RenardeResourceTest.java index d079fd9..ca2b030 100644 --- a/integration-tests/src/test/java/io/quarkiverse/renarde/it/RenardeResourceTest.java +++ b/integration-tests/src/test/java/io/quarkiverse/renarde/it/RenardeResourceTest.java @@ -175,6 +175,17 @@ public void testValidationError() { "Email: must be a well-formed email address\n\n\nManual: Required\n\n\nRequired: must not be blank\n\n\n")); } + @Test + public void testValidationErrorOnNamedRestForm() { + given() + .when() + .formParam("foo", "123456") + .post("/Application/withLengthValidation") + .then() + .statusCode(200) + .body(is("Got 'foo' param: 123456, has errors: true, 'foo' error: length must be between 2 and 4")); + } + @Test public void testValidationErrorFlash() { RenardeCookieFilter cookieFilter = new RenardeCookieFilter();