{
Map<String, ResourceModel> resourceModelMap = buildResourceModels(
StatusCollectionResource.class,
LocationResource.class,
DiscoveredItemsResource.class);
ResourceModel statusResourceModel = resourceModelMap.get("/statuses");
ResourceModel discoveredItemsResourceModel = resourceModelMap.get("/discovereditems");
ResourceMethodDescriptor methodDescriptor;
StatusCollectionResource statusResource;
DiscoveredItemsResource discoveredItemsResource;
// #1: simple filter
methodDescriptor = statusResourceModel.findNamedMethod("public_timeline");
statusResource = getMockResource(StatusCollectionResource.class);
EasyMock.expect(statusResource.getPublicTimeline((PagingContext)EasyMock.anyObject())).andReturn(null).once();
checkInvocation(statusResource,
methodDescriptor,
"GET",
version,
"/statuses?q=public_timeline");
// #2: get
methodDescriptor = statusResourceModel.findMethod(ResourceMethod.GET);
statusResource = getMockResource(StatusCollectionResource.class);
EasyMock.expect(statusResource.get(eq(1L))).andReturn(null).once();
checkInvocation(statusResource, methodDescriptor, "GET",
version, "/statuses/1", buildPathKeys("statusID", 1L));
// #3: get simple sub-resource
ResourceModel locationResourceModel = statusResourceModel.getSubResource(
"location");
LocationResource locationResource;
methodDescriptor = locationResourceModel.findMethod(ResourceMethod.GET);
locationResource = getMockResource(LocationResource.class);
EasyMock.expect(locationResource.get()).andReturn(null).once();
checkInvocation(locationResource, methodDescriptor, "GET",
version, "/statuses/1/location", buildPathKeys("statusID", 1L));