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

rzo1 pushed a commit to branch opennlp-1.x
in repository https://gitbox.apache.org/repos/asf/opennlp.git

commit aec0d37745b894fb01290c379a73aa3a2b13c71e
Author: Richard Zowalla <[email protected]>
AuthorDate: Fri Jun 12 16:11:00 2026 +0200

    OPENNLP-1826: Fix HeadRulesTest to compile on JUnit 4
    
    The test added in #1035 used the JUnit 5 API (Assertions.assertThrows /
    Assertions.assertDoesNotThrow and package-private @Test methods), but
    opennlp-1.x runs on JUnit 4. This broke test compilation for the whole
    opennlp-tools module.
    
    Switch to org.junit.Assert with public test methods; replace
    assertDoesNotThrow(...) by invoking the call directly.
---
 .../opennlp/tools/parser/lang/en/HeadRulesTest.java  | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git 
a/opennlp-tools/src/test/java/opennlp/tools/parser/lang/en/HeadRulesTest.java 
b/opennlp-tools/src/test/java/opennlp/tools/parser/lang/en/HeadRulesTest.java
index d57db8541..8c2963a29 100644
--- 
a/opennlp-tools/src/test/java/opennlp/tools/parser/lang/en/HeadRulesTest.java
+++ 
b/opennlp-tools/src/test/java/opennlp/tools/parser/lang/en/HeadRulesTest.java
@@ -35,10 +35,10 @@ public class HeadRulesTest {
    * Positive: a well-formed head rules line with a small tag count loads 
without error.
    */
   @Test
-  void testValidTagCountLoads() throws IOException {
+  public void testValidTagCountLoads() throws IOException {
     // "5 NP 1 NN NNS" — num=5, tags=3 (5-2=3)
     String rules = "5 NP 1 NN NNS NNP\n";
-    Assertions.assertDoesNotThrow(() -> new HeadRules(new 
StringReader(rules)));
+    new HeadRules(new StringReader(rules));
   }
 
   /**
@@ -46,9 +46,9 @@ public class HeadRulesTest {
    * not attempt to allocate Integer.MAX_VALUE bytes.
    */
   @Test
-  void testOversizedTagCountThrows() {
+  public void testOversizedTagCountThrows() {
     String rules = "2147483647 NP 1\n";
-    Assertions.assertThrows(IOException.class,
+    Assert.assertThrows(IOException.class,
         () -> new HeadRules(new StringReader(rules)));
   }
 
@@ -56,9 +56,9 @@ public class HeadRulesTest {
    * Negative: a tag count that would produce a negative array size must throw 
IOException.
    */
   @Test
-  void testNegativeTagCountThrows() {
+  public void testNegativeTagCountThrows() {
     String rules = "1 NP 1\n";  // 1 - 2 = -1
-    Assertions.assertThrows(IOException.class,
+    Assert.assertThrows(IOException.class,
         () -> new HeadRules(new StringReader(rules)));
   }
 
@@ -66,10 +66,10 @@ public class HeadRulesTest {
    * Boundary: value just above MAX_TAGS_PER_RULE (1003 → numTags = 1001) must 
throw IOException.
    */
   @Test
-  void testJustAboveLimitThrows() {
+  public void testJustAboveLimitThrows() {
     // 1003 declared; 1003 - 2 = 1001 tags, which exceeds MAX_TAGS_PER_RULE 
(1000)
     String rules = "1003 NP 1\n";
-    Assertions.assertThrows(IOException.class,
+    Assert.assertThrows(IOException.class,
         () -> new HeadRules(new StringReader(rules)));
   }
 
@@ -77,9 +77,9 @@ public class HeadRulesTest {
    * Negative: non-numeric token count must throw IOException, not 
NumberFormatException.
    */
   @Test
-  void testNonNumericTagCountThrows() {
+  public void testNonNumericTagCountThrows() {
     String rules = "NaN NP 1\n";
-    Assertions.assertThrows(IOException.class,
+    Assert.assertThrows(IOException.class,
         () -> new HeadRules(new StringReader(rules)));
   }
 

Reply via email to