Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIKA-4254 - Fix non-idempotent unit test TestMimeTypes#testJavaRegex #1754

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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