Skip to content

Commit 5132c7d

Browse files
committed
[Update] ArgumentsRunnerInstanceMethodTest, ArgumentsRunnerStaticMethodTest 优化'getCommandNamesTest'测试项;
1 parent 5c83d95 commit 5132c7d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/test/java/net/lamgc/utils/base/runner/ArgumentsRunnerInstanceMethodTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,22 @@
66
import net.lamgc.utils.base.runner.exception.ParameterNoFoundException;
77
import org.junit.Assert;
88
import org.junit.Test;
9+
import org.slf4j.LoggerFactory;
910

11+
import java.util.Arrays;
1012
import java.util.Date;
13+
import java.util.Set;
1114

1215
public class ArgumentsRunnerInstanceMethodTest {
1316

14-
private static InstanceRunnerTestMain testMain = new InstanceRunnerTestMain();
17+
private final 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[] commands = new String[commandNames.size()];
23+
commandNames.toArray(commands);
24+
LoggerFactory.getLogger(this.getClass().getSimpleName()).info("Commands: {}", Arrays.toString(commands));
1925
}
2026

2127
@Test

src/test/java/net/lamgc/utils/base/runner/ArgumentsRunnerStaticMethodTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@
66
import net.lamgc.utils.base.runner.exception.ParameterNoFoundException;
77
import org.junit.Assert;
88
import org.junit.Test;
9+
import org.slf4j.LoggerFactory;
910

11+
import java.util.Arrays;
1012
import java.util.Date;
13+
import java.util.Set;
1114

1215
public 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[] commands = new String[commandNames.size()];
21+
commandNames.toArray(commands);
22+
LoggerFactory.getLogger(this.getClass().getSimpleName()).info("Commands: {}", Arrays.toString(commands));
1723
}
1824

1925
@Test

0 commit comments

Comments
 (0)