Search in sources :

Example 1 with ErrorResponse

use of ca.corefacility.bioinformatics.irida.web.controller.api.exception.ErrorResponse in project irida by phac-nml.

the class ControllerExceptionHandlerTest method testHandleOtherExceptions.

@Test
public void testHandleOtherExceptions() {
    ResponseEntity<ErrorResponse> response = controller.handleAllOtherExceptions(new Exception("exception"));
    assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
}
Also used : EntityExistsException(ca.corefacility.bioinformatics.irida.exceptions.EntityExistsException) EntityNotFoundException(ca.corefacility.bioinformatics.irida.exceptions.EntityNotFoundException) ConstraintViolationException(javax.validation.ConstraintViolationException) InvalidPropertyException(ca.corefacility.bioinformatics.irida.exceptions.InvalidPropertyException) ErrorResponse(ca.corefacility.bioinformatics.irida.web.controller.api.exception.ErrorResponse) Test(org.junit.Test)

Example 2 with ErrorResponse

use of ca.corefacility.bioinformatics.irida.web.controller.api.exception.ErrorResponse in project irida by phac-nml.

the class ControllerExceptionHandlerTest method testHandleExistsException.

@Test
public void testHandleExistsException() {
    ResponseEntity<ErrorResponse> response = controller.handleExistsException(new EntityExistsException("exists"));
    assertEquals(HttpStatus.CONFLICT, response.getStatusCode());
}
Also used : EntityExistsException(ca.corefacility.bioinformatics.irida.exceptions.EntityExistsException) ErrorResponse(ca.corefacility.bioinformatics.irida.web.controller.api.exception.ErrorResponse) Test(org.junit.Test)

Example 3 with ErrorResponse

use of ca.corefacility.bioinformatics.irida.web.controller.api.exception.ErrorResponse in project irida by phac-nml.

the class ControllerExceptionHandlerTest method testHandleInvalidPropertyException.

@Test
public void testHandleInvalidPropertyException() {
    ResponseEntity<ErrorResponse> response = controller.handleInvalidPropertyException(new InvalidPropertyException("invalid property"));
    assertEquals(HttpStatus.BAD_REQUEST, response.getStatusCode());
}
Also used : InvalidPropertyException(ca.corefacility.bioinformatics.irida.exceptions.InvalidPropertyException) ErrorResponse(ca.corefacility.bioinformatics.irida.web.controller.api.exception.ErrorResponse) Test(org.junit.Test)

Example 4 with ErrorResponse

use of ca.corefacility.bioinformatics.irida.web.controller.api.exception.ErrorResponse in project irida by phac-nml.

the class ControllerExceptionHandlerTest method testHandleNotFoundException.

@Test
public void testHandleNotFoundException() {
    ResponseEntity<ErrorResponse> response = controller.handleNotFoundException(new EntityNotFoundException("not found"));
    assertEquals(HttpStatus.NOT_FOUND, response.getStatusCode());
}
Also used : EntityNotFoundException(ca.corefacility.bioinformatics.irida.exceptions.EntityNotFoundException) ErrorResponse(ca.corefacility.bioinformatics.irida.web.controller.api.exception.ErrorResponse) Test(org.junit.Test)

Aggregations

ErrorResponse (ca.corefacility.bioinformatics.irida.web.controller.api.exception.ErrorResponse)4 Test (org.junit.Test)4 EntityExistsException (ca.corefacility.bioinformatics.irida.exceptions.EntityExistsException)2 EntityNotFoundException (ca.corefacility.bioinformatics.irida.exceptions.EntityNotFoundException)2 InvalidPropertyException (ca.corefacility.bioinformatics.irida.exceptions.InvalidPropertyException)2 ConstraintViolationException (javax.validation.ConstraintViolationException)1