File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
main/java/net/lamgc/utils/base/runner
test/java/net/lamgc/utils/base/runner Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 1919 */
2020public class ArgumentsRunner {
2121
22-
2322 private final static Pattern COMMAND_NAME_CHECK_PATTERN = Pattern .compile ("^[^ ]+$" );
2423
2524 private final ArgumentsRunnerConfig config ;
2625
2726 private final Class <?> runClass ;
28- private CommandMap commandMap ;
27+ private final CommandMap commandMap ;
2928
3029 /**
3130 * 无配置启动一个运行器.
Original file line number Diff line number Diff line change 66import net .lamgc .utils .base .runner .exception .ParameterNoFoundException ;
77import org .junit .Assert ;
88import org .junit .Test ;
9+ import org .slf4j .LoggerFactory ;
910
11+ import java .util .Arrays ;
1012import java .util .Date ;
13+ import java .util .Set ;
1114
1215public class ArgumentsRunnerInstanceMethodTest {
1316
1417 private static InstanceRunnerTestMain testMain = new InstanceRunnerTestMain ();
1518
1619 @ Test
1720 public void getCommandNamesTest () {
18- new ArgumentsRunner (InstanceRunnerTestMain .class ).getCommandNames ();
21+ Set <String > commandNames = new ArgumentsRunner (InstanceRunnerTestMain .class ).getCommandNames ();
22+ String [] commandNamesArr = new String [commandNames .size ()];
23+ commandNames .toArray (commandNamesArr );
24+ LoggerFactory .getLogger (ArgumentsRunnerInstanceMethodTest .class )
25+ .info ("Commands: {}" , Arrays .toString (commandNamesArr ));
1926 }
2027
2128 @ Test
Original file line number Diff line number Diff line change 66import net .lamgc .utils .base .runner .exception .ParameterNoFoundException ;
77import org .junit .Assert ;
88import org .junit .Test ;
9+ import org .slf4j .LoggerFactory ;
910
11+ import java .util .Arrays ;
1012import java .util .Date ;
13+ import java .util .Set ;
1114
1215public class ArgumentsRunnerStaticMethodTest {
1316
1417 @ Test
1518 public void getCommandNamesTest () {
16- new ArgumentsRunner (InstanceRunnerTestMain .class ).getCommandNames ();
19+ Set <String > commandNames = new ArgumentsRunner (StaticRunnerTestMain .class ).getCommandNames ();
20+ String [] commandNamesArr = new String [commandNames .size ()];
21+ commandNames .toArray (commandNamesArr );
22+ LoggerFactory .getLogger (ArgumentsRunnerStaticMethodTest .class )
23+ .info ("Commands: {}" , Arrays .toString (commandNamesArr ));
1724 }
1825
1926 @ Test
You can’t perform that action at this time.
0 commit comments