Object o = provider.readFrom(
type, m.getGenericParameterTypes()[0],
new Annotation[0], MediaType.APPLICATION_JSON_TYPE,
new MetadataMap<String, String>(), is);
assertNotNull(o);
Book b1 = null;
Book b2 = null;
if (type.isArray()) {
assertEquals(2, ((Book[])o).length);
b1 = ((Book[])o)[0];
b2 = ((Book[])o)[1];
} else if (type == Set.class) {
Set<Book> set = CastUtils.cast((Set<?>)o);
List<Book> books = new ArrayList<Book>(new TreeSet<Book>(set));
b1 = books.get(0);
b2 = books.get(1);
} else {
List<Book> books = (List<Book>)o;
b1 = books.get(0);
b2 = books.get(1);
}
assertEquals(123, b1.getId());
assertEquals("CXF in Action", b1.getName());
assertEquals(124, b2.getId());
assertEquals("CXF Rocks", b2.getName());
}