[JAVA-29007] - Upgrade Spring Reactive exceptions (#16208)
This commit is contained in:
parent
42b9fb4598
commit
e0a6bc2da3
@ -61,4 +61,10 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</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>
|
</project>
|
||||||
|
@ -11,11 +11,11 @@ public enum ErrorDetails {
|
|||||||
|
|
||||||
API_USER_NOT_FOUND(123, "User not found", "http://example.com/123");
|
API_USER_NOT_FOUND(123, "User not found", "http://example.com/123");
|
||||||
@Getter
|
@Getter
|
||||||
private Integer errorCode;
|
private final Integer errorCode;
|
||||||
@Getter
|
@Getter
|
||||||
private String errorMessage;
|
private final String errorMessage;
|
||||||
@Getter
|
@Getter
|
||||||
private String referenceUrl;
|
private final String referenceUrl;
|
||||||
|
|
||||||
ErrorDetails(Integer errorCode, String errorMessage, String referenceUrl) {
|
ErrorDetails(Integer errorCode, String errorMessage, String referenceUrl) {
|
||||||
this.errorCode = errorCode;
|
this.errorCode = errorCode;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.baeldung.spring.reactive.customexception.controller;
|
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.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||||
@ -55,7 +55,7 @@ class UserControllerUnitTest {
|
|||||||
// Then
|
// Then
|
||||||
assertNotNull(problemDetail);
|
assertNotNull(problemDetail);
|
||||||
assertNotNull(problemDetail.getProperties().get("errors"));
|
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(),
|
assertEquals(ErrorDetails.API_USER_NOT_FOUND.getErrorCode().toString(),
|
||||||
errors.get(0).get("code"));
|
errors.get(0).get("code"));
|
||||||
assertEquals(ErrorDetails.API_USER_NOT_FOUND.getErrorMessage().toString(),
|
assertEquals(ErrorDetails.API_USER_NOT_FOUND.getErrorMessage().toString(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user