startServer(ProducesFormDataResource.class, MultiPartBeanProvider.class);
WebResource.Builder builder = client.resource(getUri()).
accept("multipart/form-data");
try {
FormDataMultiPart result = builder.get(FormDataMultiPart.class);
checkMediaType(new MediaType("multipart", "form-data"), result.getMediaType());
assertEquals(3, result.getFields().size());
assertNotNull(result.getField("foo"));
assertEquals("bar", result.getField("foo").getValue());
assertNotNull(result.getField("baz"));
assertEquals("bop", result.getField("baz").getValue());
assertNotNull(result.getField("bean"));
MultiPartBean bean = result.getField("bean").getValueAs(MultiPartBean.class);
assertNotNull(bean);
assertEquals("myname", bean.getName());
assertEquals("myvalue", bean.getValue());
result.cleanup();
} catch (UniformInterfaceException e) {
report(e);
fail("Caught exception: " + e);
}
}