You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/11/11 21:28:52 UTC

[commons-cli] branch master updated: JUnit5 assertThrows BugCLI252Test (#139)

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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f82a1f  JUnit5 assertThrows BugCLI252Test (#139)
6f82a1f is described below

commit 6f82a1f0270b6b78a28491ce08fdf9206ce8d984
Author: John Patrick <14...@users.noreply.github.com>
AuthorDate: Fri Nov 11 21:28:48 2022 +0000

    JUnit5 assertThrows BugCLI252Test (#139)
    
    * JUnit5 Api Dependency
    
    * JUnit5 assertThrows BugCLI252Test
---
 src/test/java/org/apache/commons/cli/bug/BugCLI252Test.java | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/cli/bug/BugCLI252Test.java b/src/test/java/org/apache/commons/cli/bug/BugCLI252Test.java
index e39ac52..b1efe80 100644
--- a/src/test/java/org/apache/commons/cli/bug/BugCLI252Test.java
+++ b/src/test/java/org/apache/commons/cli/bug/BugCLI252Test.java
@@ -24,6 +24,8 @@ import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.junit.Test;
 
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
 public class BugCLI252Test {
 
     private Options getOptions() {
@@ -33,9 +35,11 @@ public class BugCLI252Test {
         return options;
     }
 
-    @Test(expected = AmbiguousOptionException.class)
-    public void testAmbiquousOptionName() throws ParseException {
-        new DefaultParser().parse(getOptions(), new String[] {"--pref"});
+    @Test
+    public void testAmbiquousOptionName() {
+        assertThrows(AmbiguousOptionException.class, () ->
+                new DefaultParser().parse(getOptions(), new String[]{"--pref"})
+        );
     }
 
     @Test