CategoryWebService { @GET public List<CategoryModel> list() { return FluentIterable.from(categoriesService.retrieve().getCategories()) .transform(new Function<Category, CategoryModel>() { @Override public CategoryModel apply(Category category) { return new CategoryModel(category.getName()); } }).toSortedList(Ordering.natural()); } @Inject  CategoryWebService(CategoriesService categoriesService); @GET List<CategoryModel> list(); @POST void create(CategoryModel model); @DELETE @Path("{name}") void delete(@PathParam("name") String name); @POST @Path("{name}/rules") void addRule(@PathParam("name") String name, CategoryRuleModel ruleModel);  }
@Test public void list() { List<CategoryModel> list = service.list(); assertNotNull(list); assertEquals(3, list.size()); assertEquals("a", list.get(0).getName()); assertEquals("B", list.get(1).getName()); assertEquals("c", list.get(2).getName()); }