[JAVA-29007] - Upgrade Spring Reactive exceptions (#16208)

This commit is contained in:
Amit Pandey 2024-03-25 04:38:15 +05:30 committed by GitHub
parent 42b9fb4598
commit e0a6bc2da3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 5 deletions

View File

@ -61,4 +61,10 @@
</plugins>
</build>
<properties>
<spring-boot.version>3.2.2</spring-boot.version>
<junit-jupiter.version>5.10.2</junit-jupiter.version>
<maven.compiler.release>17</maven.compiler.release>
</properties>
</project>

View File

@ -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;

View File

@ -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<LinkedHashMap> errors = (List<LinkedHashMap>) problemDetail.getProperties().get("errors");
List<LinkedHashMap<String,Object>> errors = (List<LinkedHashMap<String,Object>>) 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(),