This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch OPENNLP-1582-Remove-Mockito-Dependency
in repository https://gitbox.apache.org/repos/asf/opennlp.git

commit f486c53f7aa65329f6b707a6730f38658ac64942
Author: Richard Zowalla <[email protected]>
AuthorDate: Thu Jun 27 13:39:19 2024 +0200

    OPENNLP-1582 - Remove Mockito Dependency
---
 opennlp-tools/pom.xml                                  |  7 -------
 .../tools/namefind/TokenNameFinderEvaluatorTest.java   | 18 +++++++++++-------
 pom.xml                                                |  1 -
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/opennlp-tools/pom.xml b/opennlp-tools/pom.xml
index 3c2793ca..cd8714e4 100644
--- a/opennlp-tools/pom.xml
+++ b/opennlp-tools/pom.xml
@@ -57,13 +57,6 @@
       <scope>test</scope>
     </dependency>
 
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <version>${mockito.version}</version>
-      <scope>test</scope>
-    </dependency>
-
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
diff --git 
a/opennlp-tools/src/test/java/opennlp/tools/namefind/TokenNameFinderEvaluatorTest.java
 
b/opennlp-tools/src/test/java/opennlp/tools/namefind/TokenNameFinderEvaluatorTest.java
index 99a580e8..77b89d35 100644
--- 
a/opennlp-tools/src/test/java/opennlp/tools/namefind/TokenNameFinderEvaluatorTest.java
+++ 
b/opennlp-tools/src/test/java/opennlp/tools/namefind/TokenNameFinderEvaluatorTest.java
@@ -26,10 +26,6 @@ import org.junit.jupiter.api.Test;
 import opennlp.tools.cmdline.namefind.NameEvaluationErrorListener;
 import opennlp.tools.util.Span;
 
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 /**
  * This is the test class for {@link TokenNameFinderEvaluator}.
  */
@@ -39,9 +35,17 @@ public class TokenNameFinderEvaluatorTest {
    * Return a dummy name finder that always return something expected
    */
   public TokenNameFinder mockTokenNameFinder(Span[] ret) {
-    TokenNameFinder mockInstance = mock(TokenNameFinder.class);
-    when(mockInstance.find(any(String[].class))).thenReturn(ret);
-    return mockInstance;
+    return new TokenNameFinder() {
+      @Override
+      public Span[] find(String[] tokens) {
+        return ret;
+      }
+
+      @Override
+      public void clearAdaptiveData() {
+        //nothing to do here
+      }
+    };
   }
 
   @Test
diff --git a/pom.xml b/pom.xml
index 037d4676..82785c03 100644
--- a/pom.xml
+++ b/pom.xml
@@ -185,7 +185,6 @@
                <maven.surefire.plugin>3.2.2</maven.surefire.plugin>
                <maven.failsafe.plugin>3.2.2</maven.failsafe.plugin>
                <forbiddenapis.plugin>3.7</forbiddenapis.plugin>
-               <mockito.version>3.9.0</mockito.version>
        </properties>
 
        <build>

Reply via email to