  @Test
  public void testProperDetectingOrder()
  {

    final OrderedContentTypeDetector regexFirst = new OrderedContentTypeDetector(
        new UrlFileExtensionTypeDetector(),
        new HeadersContentTypeDetector()
    );
    final OrderedContentTypeDetector headersFirst = new OrderedContentTypeDetector(
        new HeadersContentTypeDetector(),
        new UrlFileExtensionTypeDetector()
    );

    assertEquals(FilterEngine.ContentType.IMAGE,
        regexFirst.detect(mockRequest(URI_IMAGE, XML_HEADER)));
    assertEquals(FilterEngine.ContentType.XMLHTTPREQUEST,
        headersFirst.detect(mockRequest(URI_IMAGE, XML_HEADER)));
    assertEquals(FilterEngine.ContentType.SUBDOCUMENT,
        headersFirst.detect(mockRequest(URI_IMAGE, SUBDOCUMENT_HEADER)));
  }