diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/pom.xml b/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/pom.xml index 33a3aba03b..8237955aef 100644 --- a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/pom.xml +++ b/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/pom.xml @@ -10,7 +10,7 @@ com.baeldung pass-exception-to-client-json-spring-boot - 0.0.3-SNAPSHOT + 0.0.4-SNAPSHOT pass-exception-to-client-json-spring-boot Baeldung article code on how to pass exceptions to client in JSON format using Spring Boot diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/ErrorHandler.java b/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/ErrorHandler.java index d69f60b75e..b39d2811dd 100644 --- a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/ErrorHandler.java +++ b/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/main/java/com/baeldung/passexceptiontoclientjsonspringboot/ErrorHandler.java @@ -13,9 +13,7 @@ public class ErrorHandler { @ExceptionHandler(CustomException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public CustomException handleCustomException(CustomException ce) { - return ce; - } } \ No newline at end of file diff --git a/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/test/java/com/baeldung/passexceptiontoclientjsonspringboot/MainControllerIntegrationTest.java b/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/test/java/com/baeldung/passexceptiontoclientjsonspringboot/MainControllerIntegrationTest.java new file mode 100644 index 0000000000..a615dc5096 --- /dev/null +++ b/spring-boot-exceptions/pass-exception-to-client-json-spring-boot/src/test/java/com/baeldung/passexceptiontoclientjsonspringboot/MainControllerIntegrationTest.java @@ -0,0 +1,16 @@ +package com.baeldung.passexceptiontoclientjsonspringboot; + +import org.junit.Test; + +public class MainControllerIntegrationTest { + + @Test(expected = CustomException.class) + public void givenIndex_thenCustomException() throws CustomException { + + MainController mainController = new MainController(); + + mainController.index(); + + } + +} \ No newline at end of file