diff --git a/integration-tests/jaxb/src/main/java/io/quarkus/it/jaxb/JaxbResource.java b/integration-tests/jaxb/src/main/java/io/quarkus/it/jaxb/JaxbResource.java
index d6a9b8e386574d..3b1b1b8c356589 100644
--- a/integration-tests/jaxb/src/main/java/io/quarkus/it/jaxb/JaxbResource.java
+++ b/integration-tests/jaxb/src/main/java/io/quarkus/it/jaxb/JaxbResource.java
@@ -56,6 +56,15 @@ public Response postBook(Book book) {
}
}
+ // test for marshalling and unmarshalling with jaxb
+ @Path("/book/xml")
+ @POST
+ @Consumes(MediaType.APPLICATION_XML)
+ @Produces(MediaType.APPLICATION_XML)
+ public Book postBookXml(Book book) {
+ return book;
+ }
+
@GET
@Path("/see-also")
@Produces(MediaType.APPLICATION_XML)
diff --git a/integration-tests/jaxb/src/test/java/io/quarkus/it/jaxb/JaxbTest.java b/integration-tests/jaxb/src/test/java/io/quarkus/it/jaxb/JaxbTest.java
index 83d1d80aedd859..5cc0b92986643b 100644
--- a/integration-tests/jaxb/src/test/java/io/quarkus/it/jaxb/JaxbTest.java
+++ b/integration-tests/jaxb/src/test/java/io/quarkus/it/jaxb/JaxbTest.java
@@ -34,4 +34,35 @@ public void seeAlso() {
.body("response.evenMoreZeep", is(equalTo("ZEEEP")));
}
+ @Test
+ public void testMarshallingAndUnmarshalling() {
+ given().when()
+ .contentType(ContentType.XML)
+ .body(new Book("1984", null))
+ .post("/jaxb/book/xml")
+ .then()
+ .statusCode(200)
+ .contentType(ContentType.XML)
+ .log().ifValidationFails()
+ .body(is(
+ "1984"));
+ }
+
+ @Test
+ public void testInvalidXmlInRequestBody() {
+ String invalidXml = """
+
+
+ 1984
+
+
+ """;
+ given().when()
+ .contentType(ContentType.XML)
+ .body(invalidXml)
+ .post("/jaxb/book/xml")
+ .then()
+ .statusCode(400);
+ }
+
}