}
@Test
public void testHandleGetFriendsWithParams() throws Exception {
String path = "/people/john.doe/@friends";
RestHandler operation = registry.getRestHandler(path, "GET");
CollectionOptions options = new CollectionOptions();
options.setSortBy(Person.Field.NAME.toString());
options.setSortOrder(SortOrder.descending);
options.setFilter(PersonService.TOP_FRIENDS_FILTER);
options.setFilterOperation(FilterOperation.present);
options.setFilterValue("cassie");
options.setFirst(5);
options.setMax(10);
Map<String, String[]> params = Maps.newHashMap();
params.put("sortBy", new String[]{options.getSortBy()});
params.put("sortOrder", new String[]{options.getSortOrder().toString()});
params.put("filterBy", new String[]{options.getFilter()});
params.put("filterOp", new String[]{options.getFilterOperation().toString()});
params.put("filterValue", new String[]{options.getFilterValue()});
params.put("startIndex", new String[]{"5"});
params.put("count", new String[]{"10"});
params.put("fields", new String[]{"money,fame,fortune"});
List<Person> people = ImmutableList.of();
RestfulCollection<Person> data = new RestfulCollection<Person>(people);
expect(personService.getPeople(
eq(JOHN_DOE),
eq(new GroupId(GroupId.Type.friends, null)), eq(options),
eq(ImmutableSortedSet.of("money", "fame", "fortune")), eq(token)))
.andReturn(ImmediateFuture.newInstance(data));
replay();
assertEquals(data, operation.execute(params, null, token, converter).get());
verify();
}