@BeforeEach
    public void setUp() {
        Map<Pattern, MediaType> patterns = new HashMap<>();
        patterns.put(Pattern.compile(".*\\.txt", Pattern.CASE_INSENSITIVE), MediaType.TEXT_PLAIN);
        patterns.put(Pattern.compile("README"), MediaType.TEXT_PLAIN);
        patterns.put(Pattern.compile(".*\\.hdr"), MediaType.application("envi.hdr"));
        detector = new NameDetector(patterns);
    }
Test cases for the {@link NameDetector} class.
tika-core/src/test/java/org/apache/tika/detect/NameDetectorTest.java