Map<String, String> responses = new HashMap<String, String>();
FormRepresentation form = RESTAbstractTest.createMockForm("form2", "oneParam");
String jsonForm = FormEncodingFactory.getEncoder().encode(form);
responses.put("GET " + helper.getApiSearchUrl("somePackage") + "form2AutoForm.formdef", jsonForm);
EasyMock.expect(client.executeMethod(EasyMock.anyObject(MockGetMethod.class))).
andAnswer(new MockAnswer(responses, new IllegalArgumentException("unexpected call"))).anyTimes();
GuvnorFormDefinitionService service = createService(baseUrl, "", "");
service.getHelper().setClient(client);
FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
EasyMock.expect(decoder.decode(EasyMock.eq(jsonForm))).andThrow(new FormEncodingException("Something going wrong")).once();
FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), decoder);