Search in sources :

Example 1 with IllegalClientIdException

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");
}
Also used : Problem(org.zalando.problem.Problem) NativeWebRequest(org.springframework.web.context.request.NativeWebRequest) IllegalClientIdException(org.zalando.nakadi.exceptions.IllegalClientIdException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 NativeWebRequest (org.springframework.web.context.request.NativeWebRequest)1 IllegalClientIdException (org.zalando.nakadi.exceptions.IllegalClientIdException)1 Problem (org.zalando.problem.Problem)1