Add integration test, bump version to 0.0.4
This commit is contained in:
parent
8463567986
commit
a2002dde52
|
@ -10,7 +10,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>pass-exception-to-client-json-spring-boot</artifactId>
|
<artifactId>pass-exception-to-client-json-spring-boot</artifactId>
|
||||||
<version>0.0.3-SNAPSHOT</version>
|
<version>0.0.4-SNAPSHOT</version>
|
||||||
<name>pass-exception-to-client-json-spring-boot</name>
|
<name>pass-exception-to-client-json-spring-boot</name>
|
||||||
<description>Baeldung article code on how to pass exceptions to client in JSON format using Spring Boot</description>
|
<description>Baeldung article code on how to pass exceptions to client in JSON format using Spring Boot</description>
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,7 @@ public class ErrorHandler {
|
||||||
@ExceptionHandler(CustomException.class)
|
@ExceptionHandler(CustomException.class)
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
public CustomException handleCustomException(CustomException ce) {
|
public CustomException handleCustomException(CustomException ce) {
|
||||||
|
|
||||||
return ce;
|
return ce;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue