public static Exception toException(int code, String msg) throws Exception {
        if (code == Response.Status.NOT_FOUND.getStatusCode()) {
            throw new NotFoundException(msg);
        } else if (code == Response.Status.NOT_IMPLEMENTED.getStatusCode()) {
            throw new ClassNotFoundException(msg);
        } else if (code == Response.Status.BAD_REQUEST.getStatusCode()) {
            throw new InvalidRequestException(msg);
        } else if (code == Response.Status.CONFLICT.getStatusCode()) {
            throw new RequestConflictException(msg);
        } else {
            throw new RuntimeException(msg);
        }
    }
@Test
    public void testToExceptionNotFoundException() {
        assertThrows(NotFoundException.class,
            () -> RestExceptionMapper.toException(Response.Status.NOT_FOUND.getStatusCode(), "Not Found"));
    }