@Test
public void testDetectStreamReadProblems() throws Exception {

    byte[] data = "abcdefghijklmnopqrstuvwxyz0123456789".getBytes(US_ASCII);
    MediaType testMT = new MediaType("application", "test");
    Detector detector = new MagicDetector(testMT, data, null, false, 0, 0);
    // Deliberately prevent InputStream.read(...) from reading the entire
    // buffer in one go
    InputStream stream = new RestrictiveInputStream(data);
    assertEquals(testMT, detector.detect(stream, new Metadata()));
}