FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
TaskDefinitionService taskService = EasyMock.createMock(TaskDefinitionService.class);
TaskRef task = new TaskRef();
task.setPackageName("somePackage");
EasyMock.expect(taskService.getBPMN2Task(EasyMock.eq(xml), EasyMock.eq("PROCESS_NAME"), EasyMock.eq("USER_TASK"))).
andThrow(new TaskServiceException("problem")).once();
EmbedingServlet servlet = createServlet(formService, taskService);
response.sendError(EasyMock.eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), EasyMock.anyObject(String.class));
EasyMock.expectLastCall().once();
EasyMock.replay(request, response, formService, taskService);