test_class.declarator: json = new JsonRepresentation(MediaType.parse("application/json"), new JsonFactory())
test_class.modifier: private
test_class.original_string: private Representation json = new JsonRepresentation(MediaType.parse("application/json"), new JsonFactory());
test_class.type: Representation
test_class.var_name: json
test_class.declarator: html = new HtmlRepresentation()
test_class.modifier: private
test_class.original_string: private Representation html = new HtmlRepresentation();
test_class.type: Representation
test_class.var_name: html
test_class.file: oak-http/src/test/java/org/apache/jackrabbit/oak/http/AcceptHeaderTest.java
test_class.identifier: AcceptHeaderTest
test_case.body: @Test
      public void testSpecificTypePlusGenericRange() {
          // both have the same q value (default of 1.0), but application/json is more specific
          // see RFC 7231, Section 5.3.2
          AcceptHeader ah = new AcceptHeader("application/json, */*");
          Representation selected;
  
          selected = ah.resolve(json);
          assertEquals(json, selected);
  
          selected = ah.resolve(html);
          assertEquals(html, selected);
  
          selected = ah.resolve(html);
          assertEquals(html, selected);
  
          selected = ah.resolve(json, html);
          assertEquals(json, selected);
  
          // OAK-8135
          selected = ah.resolve(html, json);
          assertEquals(json, selected);
   
          // retry with q values
          ah = new AcceptHeader("application/json; q=0.4, */*; q=0.5");
          selected = ah.resolve(html, json);
          assertEquals(html, selected);
  
          ah = new AcceptHeader("application/json, */*; q=0.5");
          selected = ah.resolve(html, json);
          assertEquals(json, selected);
      }
test_case.class_method_signature: AcceptHeaderTest.testSpecificTypePlusGenericRange()
test_case.full_signature: @Test public void testSpecificTypePlusGenericRange()
test_case.identifier: testSpecificTypePlusGenericRange
test_case.invocations: resolve assertEquals resolve assertEquals resolve assertEquals resolve assertEquals resolve assertEquals resolve assertEquals resolve assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSpecificTypePlusGenericRange()
focal_class.declarator: registry =
              MediaTypeRegistry.getDefaultRegistry()
focal_class.modifier: private static final
focal_class.original_string: private static final MediaTypeRegistry registry =
              MediaTypeRegistry.getDefaultRegistry();
focal_class.type: MediaTypeRegistry
focal_class.var_name: registry
focal_class.declarator: ranges = new ArrayList<MediaRange>()
focal_class.modifier: private final
focal_class.original_string: private final List<MediaRange> ranges = new ArrayList<MediaRange>();
focal_class.type: List<MediaRange>
focal_class.var_name: ranges
focal_class.file: oak-http/src/main/java/org/apache/jackrabbit/oak/http/AcceptHeader.java
focal_class.identifier: AcceptHeader
focal_class.class_method_signature: AcceptHeader.AcceptHeader(String accept)
focal_class.full_signature: public  AcceptHeader(String accept)
focal_class.identifier: AcceptHeader
focal_class.modifiers: public
focal_class.parameters: (String accept)
focal_class.signature:  AcceptHeader(String accept)
focal_class.class_method_signature: AcceptHeader.resolve(Representation... representations)
focal_class.full_signature: public Representation resolve(Representation... representations)
focal_class.identifier: resolve
focal_class.modifiers: public
focal_class.parameters: (Representation... representations)
focal_class.return: Representation
focal_class.signature: Representation resolve(Representation... representations)
focal_method.body: public Representation resolve(Representation... representations) {
          checkArgument(representations != null && representations.length > 0);
          int maxIndex = 0;
          double maxQ = 0.0;
          for (int i = 0; i < representations.length; i++) {
              double q = 0.0;
              MediaType type = registry.normalize(representations[i].getType());
              for (MediaRange range : ranges) {
                  q = Math.max(q, range.match(type, registry));
              }
              if (q > maxQ) {
                  maxIndex = i;
                  maxQ = q;
              }
          }
          return representations[maxIndex];
      }
focal_method.class_method_signature: AcceptHeader.resolve(Representation... representations)
focal_method.full_signature: public Representation resolve(Representation... representations)
focal_method.identifier: resolve
focal_method.invocations: checkArgument normalize getType max match
focal_method.modifiers: public
focal_method.parameters: (Representation... representations)
focal_method.return: Representation
focal_method.signature: Representation resolve(Representation... representations)