Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
public class TestMimeTypes {

private static final File f = new File("/a/b/c/x.pdf");
private static final MimeType testType = new MimeType(MediaType.parse("foo/bar"));
private static final MimeType testType2 = new MimeType(MediaType.parse("foo/bar2"));
private Tika tika;
private MimeTypes repo;
private URL u;
Expand Down Expand Up @@ -844,15 +846,13 @@ public void testDITADetection() throws Exception {
*/
@Test
public void testJavaRegex() throws Exception {
MimeType testType = new MimeType(MediaType.parse("foo/bar"));
this.repo.add(testType);
assertNotNull(repo.forName("foo/bar"));
String pattern = "rtg_sst_grb_0\\.5\\.\\d{8}";
this.repo.addPattern(testType, pattern, true);
String testFileName = "rtg_sst_grb_0.5.12345678";
assertEquals("foo/bar", tika.detect(testFileName));

MimeType testType2 = new MimeType(MediaType.parse("foo/bar2"));
this.repo.add(testType2);
assertNotNull(repo.forName("foo/bar2"));
this.repo.addPattern(testType2, pattern, false);
Expand Down