From e0a6bc2da39ed3b166ecf2fd09ec09ced6135e39 Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Mon, 25 Mar 2024 04:38:15 +0530 Subject: [PATCH] [JAVA-29007] - Upgrade Spring Reactive exceptions (#16208) --- spring-reactive-modules/spring-reactive-exceptions/pom.xml | 6 ++++++ .../spring/reactive/customexception/model/ErrorDetails.java | 6 +++--- .../customexception/controller/UserControllerUnitTest.java | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/spring-reactive-modules/spring-reactive-exceptions/pom.xml b/spring-reactive-modules/spring-reactive-exceptions/pom.xml index 1f24f9cd1c..8cde579ddb 100644 --- a/spring-reactive-modules/spring-reactive-exceptions/pom.xml +++ b/spring-reactive-modules/spring-reactive-exceptions/pom.xml @@ -61,4 +61,10 @@ + + 3.2.2 + 5.10.2 + 17 + + diff --git a/spring-reactive-modules/spring-reactive-exceptions/src/main/java/com/baeldung/spring/reactive/customexception/model/ErrorDetails.java b/spring-reactive-modules/spring-reactive-exceptions/src/main/java/com/baeldung/spring/reactive/customexception/model/ErrorDetails.java index a4ca566c71..357998dda1 100644 --- a/spring-reactive-modules/spring-reactive-exceptions/src/main/java/com/baeldung/spring/reactive/customexception/model/ErrorDetails.java +++ b/spring-reactive-modules/spring-reactive-exceptions/src/main/java/com/baeldung/spring/reactive/customexception/model/ErrorDetails.java @@ -11,11 +11,11 @@ public enum ErrorDetails { API_USER_NOT_FOUND(123, "User not found", "http://example.com/123"); @Getter - private Integer errorCode; + private final Integer errorCode; @Getter - private String errorMessage; + private final String errorMessage; @Getter - private String referenceUrl; + private final String referenceUrl; ErrorDetails(Integer errorCode, String errorMessage, String referenceUrl) { this.errorCode = errorCode; diff --git a/spring-reactive-modules/spring-reactive-exceptions/src/test/java/com/baeldung/spring/reactive/customexception/controller/UserControllerUnitTest.java b/spring-reactive-modules/spring-reactive-exceptions/src/test/java/com/baeldung/spring/reactive/customexception/controller/UserControllerUnitTest.java index 150d0b08a6..c4306e6e62 100644 --- a/spring-reactive-modules/spring-reactive-exceptions/src/test/java/com/baeldung/spring/reactive/customexception/controller/UserControllerUnitTest.java +++ b/spring-reactive-modules/spring-reactive-exceptions/src/test/java/com/baeldung/spring/reactive/customexception/controller/UserControllerUnitTest.java @@ -1,6 +1,6 @@ package com.baeldung.spring.reactive.customexception.controller; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; @@ -55,7 +55,7 @@ class UserControllerUnitTest { // Then assertNotNull(problemDetail); assertNotNull(problemDetail.getProperties().get("errors")); - List errors = (List) problemDetail.getProperties().get("errors"); + List> errors = (List>) problemDetail.getProperties().get("errors"); assertEquals(ErrorDetails.API_USER_NOT_FOUND.getErrorCode().toString(), errors.get(0).get("code")); assertEquals(ErrorDetails.API_USER_NOT_FOUND.getErrorMessage().toString(),