public void testSaveFormEncodingProblem() throws Exception {
RESTFormService restService = new RESTFormService();
FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), decoder);
FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
FormRepresentation form = RESTAbstractTest.createMockForm("formToBeSaved", "param1", "param2", "param3");
FormEncodingException exception = new FormEncodingException("Something going wrong");
EasyMock.expect(decoder.decode(EasyMock.anyObject(String.class))).andThrow(exception).once();
restService.setFormService(formService);
ServletContext context = EasyMock.createMock(ServletContext.class);
HttpSession session = EasyMock.createMock(HttpSession.class);