You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2021/03/16 14:15:03 UTC
[tika] branch main updated: TIKA-3323 -- allow flexibility for
'file' command output on different operating systems.
This is an automated email from the ASF dual-hosted git repository.
tallison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/main by this push:
new 4428958 TIKA-3323 -- allow flexibility for 'file' command output on different operating systems.
4428958 is described below
commit 4428958e7ddbfc629a5a7b0ca220bcfec0cae315
Author: tallison <ta...@apache.org>
AuthorDate: Tue Mar 16 10:14:49 2021 -0400
TIKA-3323 -- allow flexibility for 'file' command output on different operating systems.
---
.../apache/tika/detect/FileCommandDetectorTest.java | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/tika-core/src/test/java/org/apache/tika/detect/FileCommandDetectorTest.java b/tika-core/src/test/java/org/apache/tika/detect/FileCommandDetectorTest.java
index d4580ce..27b437b 100644
--- a/tika-core/src/test/java/org/apache/tika/detect/FileCommandDetectorTest.java
+++ b/tika-core/src/test/java/org/apache/tika/detect/FileCommandDetectorTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.tika.detect;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
import java.io.InputStream;
@@ -46,17 +46,23 @@ public class FileCommandDetectorTest {
try (InputStream is = getClass()
.getResourceAsStream("/test-documents/basic_embedded.xml")) {
- assertEquals(MediaType.text("xml"), DETECTOR.detect(is, new Metadata()));
- //make sure that the detector is resetting the stream
- assertEquals(MediaType.text("xml"), DETECTOR.detect(is, new Metadata()));
+ //run more than once to ensure that the input stream is reset
+ for (int i = 0; i < 2; i++) {
+ MediaType answer = DETECTOR.detect(is, new Metadata());
+ assertTrue(MediaType.text("xml").equals(answer) ||
+ MediaType.application("xml").equals(answer));
+ }
}
//now try with TikaInputStream
try (InputStream is = TikaInputStream
.get(getClass().getResourceAsStream("/test-documents/basic_embedded.xml"))) {
- assertEquals(MediaType.text("xml"), DETECTOR.detect(is, new Metadata()));
- //make sure that the detector is resetting the stream
- assertEquals(MediaType.text("xml"), DETECTOR.detect(is, new Metadata()));
+ //run more than once to ensure that the input stream is reset
+ for (int i = 0; i < 2; i++) {
+ MediaType answer = DETECTOR.detect(is, new Metadata());
+ assertTrue(MediaType.text("xml").equals(answer) ||
+ MediaType.application("xml").equals(answer));
+ }
}
}
}