File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/test/java/org/apache/commons/cli/help Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
1717package org .apache .commons .cli .help ;
1818
1919import static org .junit .jupiter .api .Assertions .assertEquals ;
20+ import static org .junit .jupiter .api .Assertions .assertThrows ;
2021
2122import java .util .ArrayList ;
2223import java .util .List ;
@@ -132,6 +133,18 @@ void testAsSyntaxOption() {
132133 assertEquals ("[-ot <arg>]" , underTest .toSyntaxOption (), "optional multi char opt arg failed" );
133134 }
134135
136+ @ Test
137+ void testCli343Part1 () {
138+ assertThrows (IllegalStateException .class , () -> Option .builder ().required (false ).build ());
139+ assertThrows (IllegalStateException .class , () -> Option .builder ().required (false ).get ());
140+ }
141+
142+ @ Test
143+ void testCli343Part2 () {
144+ assertThrows (IllegalStateException .class , () -> Option .builder ().desc ("description" ).build ());
145+ assertThrows (IllegalStateException .class , () -> Option .builder ().desc ("description" ).get ());
146+ }
147+
135148 @ ParameterizedTest (name = "{index} {0}" )
136149 @ MethodSource ("deprecatedAttributesData" )
137150 void testComplexDeprecationFormat (final DeprecatedAttributes da , final String expected ) {
You can’t perform that action at this time.
0 commit comments