Book jaxb = new Book("jaxb", 1L);
Book json = new Book("json", 2L);
InputStream is1 =
getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/java.jpg");
List<Attachment> objects = new ArrayList<Attachment>();
objects.add(new Attachment("theroot", MediaType.APPLICATION_XML, jaxb));
objects.add(new Attachment("thejson", MediaType.APPLICATION_JSON, json));
objects.add(new Attachment("theimage", MediaType.APPLICATION_OCTET_STREAM, is1));
Collection<? extends Attachment> coll = client.postAndGetCollection(objects, Attachment.class);
List<Attachment> result = new ArrayList<Attachment>(coll);
Book jaxb2 = readBookFromInputStream(result.get(0).getDataHandler().getInputStream());
assertEquals("jaxb", jaxb2.getName());
assertEquals(1L, jaxb2.getId());