Skip to content

Commit bf2264e

Browse files
committed
Use assertThrows()
1 parent 9daa228 commit bf2264e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/test/java/org/apache/commons/cli/AbstractParserTestCase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
2323
import static org.junit.Assert.assertNotNull;
2424
import static org.junit.Assert.assertTrue;
2525
import static org.junit.Assert.fail;
26+
import static org.junit.jupiter.api.Assertions.assertThrows;
2627

2728
import java.util.Arrays;
2829
import java.util.List;
@@ -60,12 +61,11 @@ public void setUp() {
6061
//@formatter:on
6162
}
6263

63-
@Test(expected = UnrecognizedOptionException.class)
6464
public void testAmbiguousArgParsing() throws Exception {
65-
final String[] args = {"-=-"};
65+
final String[] args = { "-=-" };
6666
final Options options = new Options();
6767

68-
final CommandLine cl = parser.parse(options, args);
68+
assertThrows(UnrecognizedOptionException.class, () -> parser.parse(options, args));
6969
}
7070

7171
@Test

0 commit comments

Comments
 (0)