@Test
    public void testMimeMagicClashSamePriority() throws IOException {
        byte[] helloWorld = "Hello, World!".getBytes(UTF_8);
        MediaType helloType = MediaType.parse("hello/world-file");
        MediaType helloXType = MediaType.parse("hello/x-world-hello");
        Metadata metadata;

        // With a filename, picks the right one
        metadata = new Metadata();
        metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, "test.hello.world");
        assertEquals(helloType.toString(),
                tika.detect(new ByteArrayInputStream(helloWorld), metadata));

        metadata = new Metadata();
        metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, "test.x-hello-world");
        assertEquals(helloXType.toString(),
                tika.detect(new ByteArrayInputStream(helloWorld), metadata));

        // Without, goes for the one that sorts last
        metadata = new Metadata();
        metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, "testingTESTINGtesting");
        assertEquals(helloXType.toString(),
                tika.detect(new ByteArrayInputStream(helloWorld), metadata));
    }
Tests that when two magic matches both apply, and both have the same
priority, we use the name to pick the right one based on the glob, or the
first one we come across if not. See TIKA-1292 for more details.
tika-core/src/test/java/org/apache/tika/mime/ProbabilisticMimeDetectionTestWithTika.java