Dieser Commit ist enthalten in:
Ursprung
65df8ddab0
Commit
45e9698634
@ -140,7 +140,6 @@ public abstract class AbstractSWCommand<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(commandList);
|
Collections.sort(commandList);
|
||||||
System.out.println(commandList.stream().map(o -> o.method).collect(Collectors.toList()));
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +82,8 @@ public class SubCommand<T> implements Comparable<SubCommand<T>> {
|
|||||||
if (tVarArgs) tLength *= -1;
|
if (tVarArgs) tLength *= -1;
|
||||||
if (oVarArgs) oLength *= -1;
|
if (oVarArgs) oLength *= -1;
|
||||||
|
|
||||||
|
if (tVarArgs && oVarArgs) return Integer.compare(tLength, oLength);
|
||||||
|
|
||||||
return -Integer.compare(tLength, oLength);
|
return -Integer.compare(tLength, oLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,11 @@ public class SubCMDSortingCommand extends TestSWCommand {
|
|||||||
throw new ExecutionIdentifier("Command with 1 parameter");
|
throw new ExecutionIdentifier("Command with 1 parameter");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Register
|
||||||
|
public void test(String s, String i1, String i2, String i3, String... args) {
|
||||||
|
throw new ExecutionIdentifier("Command with 3+n parameters");
|
||||||
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void test(String s, String... args) {
|
public void test(String s, String... args) {
|
||||||
throw new ExecutionIdentifier("Command with n parameters");
|
throw new ExecutionIdentifier("Command with n parameters");
|
||||||
|
@ -58,4 +58,26 @@ public class SubCMDSortingCommandTest {
|
|||||||
assertCMDFramework(e, ExecutionIdentifier.class, "Command with n parameters");
|
assertCMDFramework(e, ExecutionIdentifier.class, "Command with n parameters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testThreeArgsVarArg() {
|
||||||
|
SubCMDSortingCommand cmd = new SubCMDSortingCommand();
|
||||||
|
try {
|
||||||
|
cmd.execute("", "", new String[]{"Hello", "World", "YoyoNow", "Hugo"});
|
||||||
|
assert false;
|
||||||
|
} catch (Exception e) {
|
||||||
|
assertCMDFramework(e, ExecutionIdentifier.class, "Command with 3+n parameters");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testThreeArgsVarArg2() {
|
||||||
|
SubCMDSortingCommand cmd = new SubCMDSortingCommand();
|
||||||
|
try {
|
||||||
|
cmd.execute("", "", new String[]{"Hello", "World", "YoyoNow"});
|
||||||
|
assert false;
|
||||||
|
} catch (Exception e) {
|
||||||
|
assertCMDFramework(e, ExecutionIdentifier.class, "Command with 3+n parameters");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren