Polishing contribution

Closes gh-35294
This commit is contained in:
rstoyanchev
2025-08-08 12:08:22 +01:00
parent 96deb27211
commit 89ba0fd6df
10 changed files with 16 additions and 26 deletions
@@ -42,12 +42,11 @@ class ProblemDetailJacksonMixinTests {
@Test
void writeStatusAndHeaders() throws Exception {
void writeStatusAndHeaders() {
ProblemDetail detail = ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, "Missing header");
testWrite(detail,
"""
{
"type": "about:blank",
"title": "Bad Request",
"status": 400,
"detail": "Missing header"
@@ -55,14 +54,13 @@ class ProblemDetailJacksonMixinTests {
}
@Test
void writeCustomProperty() throws Exception {
void writeCustomProperty() {
ProblemDetail detail = ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, "Missing header");
detail.setProperty("host", "abc.org");
detail.setProperty("user", null);
testWrite(detail, """
{
"type": "about:blank",
"title": "Bad Request",
"status": 400,
"detail": "Missing header",
@@ -72,7 +70,7 @@ class ProblemDetailJacksonMixinTests {
}
@Test
void readCustomProperty() throws Exception {
void readCustomProperty() {
ProblemDetail detail = this.mapper.readValue("""
{
"type": "about:blank",
@@ -93,7 +91,7 @@ class ProblemDetailJacksonMixinTests {
}
@Test
void readCustomPropertyFromXml() throws Exception {
void readCustomPropertyFromXml() {
ObjectMapper xmlMapper = XmlMapper.builder().addMixIn(ProblemDetail.class, ProblemDetailJacksonMixin.class).build();
ProblemDetail detail = xmlMapper.readValue("""
<problem xmlns="urn:ietf:rfc:7807">
@@ -111,7 +109,7 @@ class ProblemDetailJacksonMixinTests {
assertThat(detail.getProperties()).containsEntry("host", "abc.org");
}
private void testWrite(ProblemDetail problemDetail, String expected) throws Exception {
private void testWrite(ProblemDetail problemDetail, String expected) {
String output = this.mapper.writeValueAsString(problemDetail);
JSONAssert.assertEquals(expected, output, false);
}