use of org.zalando.nakadi.exceptions.IllegalClientIdException in project nakadi by zalando.
the class ExceptionHandlingTest method testIllegalClientIdException.
@Test
public void testIllegalClientIdException() {
final ExceptionHandling exceptionHandling = new ExceptionHandling();
final NativeWebRequest mockedRequest = Mockito.mock(NativeWebRequest.class);
Mockito.when(mockedRequest.getHeader(Matchers.any())).thenReturn("");
final ResponseEntity<Problem> problemResponseEntity = exceptionHandling.handleIllegalClientIdException(new IllegalClientIdException("You don't have access to this event type"), mockedRequest);
Assert.assertEquals(problemResponseEntity.getStatusCode(), HttpStatus.FORBIDDEN);
Assert.assertEquals(problemResponseEntity.getBody().getDetail().get(), "You don't have access to this event type");
}
Aggregations