task.setPackageName("somePackage");
EasyMock.expect(taskService.getBPMN2Task(EasyMock.eq(xml), EasyMock.eq("PROCESS_NAME"), EasyMock.eq("USER_TASK"))).andReturn(task).once();
FormRepresentation form = RESTAbstractTest.createMockForm("myForm", "myParam");
EasyMock.expect(formService.getAssociatedForm(EasyMock.eq("somePackage"), EasyMock.eq(task))).andReturn(form).once();
FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
EasyMock.expect(encoder.encode(EasyMock.eq(form))).andThrow(new FormEncodingException()).once();
EmbedingServlet servlet = createServlet(formService, taskService);
FormEncodingFactory.register(encoder, FormEncodingFactory.getDecoder());
response.sendError(EasyMock.eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), EasyMock.anyObject(String.class));
EasyMock.expectLastCall().once();