private void assertDetect(MediaType type, String name) {
        Metadata metadata = new Metadata();
        metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, name);
        try {
            assertEquals(type, detector.detect(null, metadata));
        } catch (IOException e) {
            fail("NameDetector should never throw an IOException");
        }
    }
Test cases for the {@link NameDetector} class.
tika-core/src/test/java/org/apache/tika/detect/NameDetectorTest.java