public void testSubResourceMethods()
{
AbstractResourceDescriptor resource = new AbstractResourceDescriptorImpl(SampleResource.class);
Collection<ResourceMethodMap<SubResourceMethodDescriptor>> subRes = resource.getSubResourceMethods().values();
// POST
SubResourceMethodDescriptor subResourceMethodDescriptor = subRes.iterator().next().getFirst("POST");
assertEquals("POST", subResourceMethodDescriptor.getHttpMethod());
assertEquals("{c}", subResourceMethodDescriptor.getPathValue().getPath());
assertEquals(MediaType.valueOf("text/plain"), subResourceMethodDescriptor.consumes().get(0));
assertEquals(MediaType.valueOf("text/xml"), subResourceMethodDescriptor.consumes().get(1));
assertEquals(MediaType.valueOf("text/html"), subResourceMethodDescriptor.produces().get(0));
assertEquals(SampleResource.class, subResourceMethodDescriptor.getParentResource().getObjectClass());
assertEquals(1, subResourceMethodDescriptor.getMethodParameters().size());
MethodParameter methodParameter = subResourceMethodDescriptor.getMethodParameters().get(0);
assertEquals(null, methodParameter.getDefaultValue());
assertEquals(List.class, methodParameter.getParameterClass());
assertEquals(PathParam.class, methodParameter.getAnnotation().annotationType());
assertEquals(1, methodParameter.getAnnotations().length);
assertEquals(PathParam.class, methodParameter.getAnnotations()[0].annotationType());
// GET
subResourceMethodDescriptor = subRes.iterator().next().getFirst("GET");
assertEquals("GET", subResourceMethodDescriptor.getHttpMethod());
assertEquals("{d}", subResourceMethodDescriptor.getPathValue().getPath());
assertEquals(MediaType.valueOf("text/plain"), subResourceMethodDescriptor.consumes().get(0));
assertEquals(MediaType.valueOf("text/xml"), subResourceMethodDescriptor.consumes().get(1));
assertEquals(MediaType.valueOf("text/html"), subResourceMethodDescriptor.produces().get(0));
assertEquals(SampleResource.class, subResourceMethodDescriptor.getParentResource().getObjectClass());
assertEquals(1, subResourceMethodDescriptor.getMethodParameters().size());
methodParameter = subResourceMethodDescriptor.getMethodParameters().get(0);
assertEquals(null, methodParameter.getDefaultValue());
assertEquals(List.class, methodParameter.getParameterClass());
assertEquals(PathParam.class, methodParameter.getAnnotation().annotationType());
assertEquals(1, methodParameter.getAnnotations().length);
assertEquals(PathParam.class, methodParameter.getAnnotations()[0].annotationType());
// HEAD
subResourceMethodDescriptor = subRes.iterator().next().getFirst("HEAD");
assertEquals("HEAD", subResourceMethodDescriptor.getHttpMethod());
assertEquals("{d}", subResourceMethodDescriptor.getPathValue().getPath());
assertEquals(MediaType.valueOf("text/plain"), subResourceMethodDescriptor.consumes().get(0));
assertEquals(MediaType.valueOf("text/xml"), subResourceMethodDescriptor.consumes().get(1));
assertEquals(MediaType.valueOf("text/html"), subResourceMethodDescriptor.produces().get(0));
assertEquals(SampleResource.class, subResourceMethodDescriptor.getParentResource().getObjectClass());
assertEquals(1, subResourceMethodDescriptor.getMethodParameters().size());
methodParameter = subResourceMethodDescriptor.getMethodParameters().get(0);
assertEquals(null, methodParameter.getDefaultValue());
assertEquals(List.class, methodParameter.getParameterClass());
assertEquals(PathParam.class, methodParameter.getAnnotation().annotationType());
assertEquals(1, methodParameter.getAnnotations().length);
assertEquals(PathParam.class, methodParameter.getAnnotations()[0].annotationType());