@Test
    public void testTIKA2237() throws IOException {
        Metadata metadata = new Metadata();
        metadata.add(Metadata.CONTENT_TYPE, MediaType.text("javascript").toString());
        InputStream input = new ByteArrayInputStream(
                ("function() {};\n" + "try {\n" + "    window.location = 'index.html';\n" +
                        "} catch (e) {\n" + "    console.log(e);\n" + "}")
                        .getBytes(StandardCharsets.UTF_8));
        MediaType detect = new ProbabilisticMimeDetectionSelector().detect(input, metadata);
        assertEquals(MediaType.text("javascript"), detect);
    }
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/ProbabilisticMimeDetectionTest.java