Skip to content

Commit 6f82a1f

Browse files
authored
JUnit5 assertThrows BugCLI252Test (#139)
* JUnit5 Api Dependency * JUnit5 assertThrows BugCLI252Test
1 parent 6932cec commit 6f82a1f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/test/java/org/apache/commons/cli/bug/BugCLI252Test.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import org.apache.commons.cli.ParseException;
2525
import org.junit.Test;
2626

27+
import static org.junit.jupiter.api.Assertions.assertThrows;
28+
2729
public class BugCLI252Test {
2830

2931
private Options getOptions() {
@@ -33,9 +35,11 @@ private Options getOptions() {
3335
return options;
3436
}
3537

36-
@Test(expected = AmbiguousOptionException.class)
37-
public void testAmbiquousOptionName() throws ParseException {
38-
new DefaultParser().parse(getOptions(), new String[] {"--pref"});
38+
@Test
39+
public void testAmbiquousOptionName() {
40+
assertThrows(AmbiguousOptionException.class, () ->
41+
new DefaultParser().parse(getOptions(), new String[]{"--pref"})
42+
);
3943
}
4044

4145
@Test

0 commit comments

Comments
 (0)