assertStatus(resp.getStatus(), Status.INTERNAL_SERVER_ERROR);
}
//test response to a RendererException for RESTFormService.getFormPreview(...)
public void testGetFormPreviewRendererProblem() throws Exception {
final Renderer renderer = EasyMock.createMock(Renderer.class);
final Translator translator = EasyMock.createMock(Translator.class);
final ServletContext context = EasyMock.createMock(ServletContext.class);
final HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
RESTFormService restService = emulateRESTFormService(translator, null, renderer, null);
restService.setFormService(new MockFormDefinitionService());
FormRepresentation form = createMockForm("myForm", "key1", "key2");
FormPreviewDTO dto = createFormPreviewDTO(form);
EasyMock.expect(translator.translateForm(EasyMock.eq(form))).andReturn(new URL("http://www.redhat.com")).once();
RendererException exception = new RendererException("Something going wrong");
@SuppressWarnings("unchecked")
Map<String, Object> anyObject = EasyMock.anyObject(Map.class);
EasyMock.expect(renderer.render(EasyMock.anyObject(URL.class), anyObject)).andThrow(exception).once();
EasyMock.expect(context.getContextPath()).andReturn("/").anyTimes();
EasyMock.expect(request.getLocale()).andReturn(Locale.getDefault()).once();
EasyMock.replay(renderer, translator, context, request);
Response resp = restService.getFormPreview(dto, "lang", context, request);