public void testResourceMethods()
{
AbstractResourceDescriptor resource = new AbstractResourceDescriptorImpl(SampleResource.class);
// GET
ResourceMethodDescriptor methodDescriptor = resource.getResourceMethods().getFirst("GET");
assertEquals("GET", methodDescriptor.getHttpMethod());
assertEquals(MediaTypeHelper.DEFAULT_TYPE, methodDescriptor.consumes().get(0));
assertEquals(MediaType.valueOf("application/xml"), methodDescriptor.produces().get(0));
assertEquals(SampleResource.class, methodDescriptor.getParentResource().getObjectClass());
assertEquals(1, methodDescriptor.getMethodParameters().size());
MethodParameter methodParameter = methodDescriptor.getMethodParameters().get(0);
assertEquals("hello", methodParameter.getDefaultValue());
assertEquals(String.class, methodParameter.getParameterClass());
assertEquals(PathParam.class, methodParameter.getAnnotation().annotationType());
assertEquals(2, methodParameter.getAnnotations().length);
assertEquals(PathParam.class, methodParameter.getAnnotations()[0].annotationType());
assertEquals(DefaultValue.class, methodParameter.getAnnotations()[1].annotationType());
// the same must be for HEAD
methodDescriptor = resource.getResourceMethods().getFirst("HEAD");
assertEquals("HEAD", methodDescriptor.getHttpMethod());
assertEquals(MediaTypeHelper.DEFAULT_TYPE, methodDescriptor.consumes().get(0));
assertEquals(MediaType.valueOf("application/xml"), methodDescriptor.produces().get(0));
assertEquals(SampleResource.class, methodDescriptor.getParentResource().getObjectClass());
assertEquals(1, methodDescriptor.getMethodParameters().size());
methodParameter = methodDescriptor.getMethodParameters().get(0);
assertEquals("hello", methodParameter.getDefaultValue());
assertEquals(String.class, methodParameter.getParameterClass());
assertEquals(PathParam.class, methodParameter.getAnnotation().annotationType());
assertEquals(2, methodParameter.getAnnotations().length);
assertEquals(PathParam.class, methodParameter.getAnnotations()[0].annotationType());