1 package org.oxerr.commons.ws.rs.exceptionmapper;
2
3 import static org.junit.jupiter.api.Assertions.assertEquals;
4
5 import javax.ws.rs.core.Response;
6
7 import org.junit.jupiter.api.Test;
8
9 class IllegalStateExceptionMapperTest {
10
11 private final IllegalStateExceptionMapper illegalStateExceptionMapper = new IllegalStateExceptionMapper();
12
13 @Test
14 void testToResponse() {
15 IllegalStateException illegalStateException = new IllegalStateException("Illegal state");
16 Response response = this.illegalStateExceptionMapper.toResponse(illegalStateException);
17 assertEquals(Response.Status.CONFLICT.getStatusCode(), response.getStatus());
18 ErrorEntity entity = (ErrorEntity) response.getEntity();
19 assertEquals(illegalStateException.getMessage(), entity.getMessage());
20 }
21
22 }