CandlepinException ce = mock(CandlepinException.class);
when(ce.httpReturnCode()).thenReturn(Status.CONFLICT);
when(ce.message()).thenReturn(
new ExceptionMessage().setDisplayMessage("you screwed up"));
when(req.getHeader(HttpHeaderNames.ACCEPT)).thenReturn("application/json");
when(ce.getCause()).thenReturn(new ConflictException("you screwed up"));
Response r = rem.toResponse(ce);
assertNotNull(r);
assertEquals(Status.CONFLICT.getStatusCode(), r.getStatus());
verifyMessage(r, "you screwed up");
}