forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly take produced media type into account when building validati…
…on error report Fixes: quarkusio#28324
- Loading branch information
Showing
5 changed files
with
71 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...dator-resteasy-reactive/src/main/java/io/quarkus/it/hibernate/validator/TextResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.quarkus.it.hibernate.validator; | ||
|
||
import javax.validation.constraints.Digits; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
@Path("text") | ||
public class TextResource { | ||
|
||
@GET | ||
@Path("/validate/{id}") | ||
public String validate( | ||
@Digits(integer = 5, fraction = 0, message = "numeric value out of bounds") @PathParam("id") String id) { | ||
return id; | ||
} | ||
|
||
@GET | ||
@Path("/validate/text/{id}") | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String validateText( | ||
@Digits(integer = 5, fraction = 0, message = "numeric value out of bounds") @PathParam("id") String id) { | ||
return id; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...r-resteasy-reactive/src/test/java/io/quarkus/it/hibernate/validator/TextResourceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.quarkus.it.hibernate.validator; | ||
|
||
import static io.restassured.RestAssured.when; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.restassured.http.ContentType; | ||
|
||
@QuarkusTest | ||
public class TextResourceTest { | ||
|
||
@Test | ||
public void fetchDefault() { | ||
when().get("/text/validate/boom") | ||
.then() | ||
.statusCode(400) | ||
.contentType(ContentType.TEXT); | ||
} | ||
|
||
@Test | ||
public void fetchText() { | ||
when().get("/text/validate/boom") | ||
.then() | ||
.statusCode(400) | ||
.contentType(ContentType.TEXT); | ||
} | ||
} |