DATAREST-706 - Added unit test for fixed functionality.
Original pull request: #200.
This commit is contained in:
@@ -18,6 +18,9 @@ package org.springframework.data.rest.webmvc;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.Logger;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@@ -29,9 +32,6 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.Logger;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link RepositoryRestExceptionHandler}.
|
||||
*
|
||||
@@ -79,4 +79,18 @@ public class RepositoryRestExceptionHandlerUnitTests {
|
||||
|
||||
assertThat(result.getStatusCode(), is(HttpStatus.CONFLICT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-706
|
||||
*/
|
||||
@Test
|
||||
public void forwardsExceptionForMiscellaneousFailure() {
|
||||
|
||||
String message = "My Message!";
|
||||
|
||||
ResponseEntity<ExceptionMessage> result = HANDLER.handleMiscFailures(new Exception(message));
|
||||
|
||||
assertThat(result.getBody(), is(notNullValue()));
|
||||
assertThat(result.getBody().getMessage(), is(message));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user