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 2022/05/13 11:54:43 UTC
[tika] 04/10: migrate to junit5 in tika-java7
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
commit 5bfdf933e401a22b7d1fc00033c9eb380912745b
Author: tallison <ta...@apache.org>
AuthorDate: Fri May 13 05:23:01 2022 -0400
migrate to junit5 in tika-java7
---
tika-java7/pom.xml | 7 ------
.../filetypedetector/TikaFileTypeDetectorTest.java | 26 +++++++++-------------
2 files changed, 11 insertions(+), 22 deletions(-)
diff --git a/tika-java7/pom.xml b/tika-java7/pom.xml
index 3c451188d..a3bec12e5 100644
--- a/tika-java7/pom.xml
+++ b/tika-java7/pom.xml
@@ -91,13 +91,6 @@
<artifactId>bndlib</artifactId>
<scope>provided</scope>
</dependency>
- <!-- after we migrate everything to junit5, we can get rid of this -->
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <version>${junit5.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<description>Java-7 reliant components, including FileTypeDetector implementations</description>
diff --git a/tika-java7/src/test/java/org/apache/tika/filetypedetector/TikaFileTypeDetectorTest.java b/tika-java7/src/test/java/org/apache/tika/filetypedetector/TikaFileTypeDetectorTest.java
index 48390e032..b21b7b358 100644
--- a/tika-java7/src/test/java/org/apache/tika/filetypedetector/TikaFileTypeDetectorTest.java
+++ b/tika-java7/src/test/java/org/apache/tika/filetypedetector/TikaFileTypeDetectorTest.java
@@ -16,7 +16,9 @@
*/
package org.apache.tika.filetypedetector;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.InputStream;
import java.nio.file.Files;
@@ -25,16 +27,14 @@ import java.nio.file.spi.FileTypeDetector;
import java.util.Iterator;
import java.util.ServiceLoader;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
public class TikaFileTypeDetectorTest {
- @Rule
- public TemporaryFolder tempDir = new TemporaryFolder();
+ @TempDir
+ public Path tempDir;
private Path testDirectory = null;
@@ -42,9 +42,10 @@ public class TikaFileTypeDetectorTest {
private static final String TEST_HTML = "test.html";
private static final String TEST_UNRECOGNISED_EXTENSION = "test.unrecognisedextension";
- @Before
+ @BeforeEach
public void setUp() throws Exception {
- testDirectory = tempDir.newFolder().toPath();
+ testDirectory = tempDir;
+ System.out.println(testDirectory.toAbsolutePath());
try (InputStream is = this.getClass().getResourceAsStream(TEST_CLASSPATH)) {
Files.copy(is, testDirectory.resolve(TEST_HTML));
}
@@ -53,10 +54,6 @@ public class TikaFileTypeDetectorTest {
}
}
- @After
- public void tearDown() throws Exception {
- }
-
@Test
public final void testDirectAccess() throws Exception {
String contentType = new TikaFileTypeDetector().probeContentType(testDirectory.resolve(TEST_HTML));
@@ -95,6 +92,5 @@ public class TikaFileTypeDetectorTest {
//o.a.sis.internal.storage.StoreTypeDetector appears with latest upgrade
//check that TikaFileTypeDetector appears at all
assertTrue(foundTika);
-
}
}