Update some stuff
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
yoyosource 2022-09-04 21:25:23 +02:00
Ursprung 6e6d34905a
Commit c4a8ae4c9f
4 geänderte Dateien mit 22 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -23,6 +23,7 @@ import lombok.AllArgsConstructor;
import lombok.Setter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

Datei anzeigen

@ -46,6 +46,11 @@ public class SubCommand<T> {
SubCommand(AbstractSWCommand<T> abstractSWCommand, Method method, String[] subCommand, Map<String, AbstractTypeMapper<T, ?>> localTypeMapper, Map<String, AbstractValidator<T, ?>> localValidator, boolean help, String[] description, boolean noTabComplete) {
this.abstractSWCommand = abstractSWCommand;
this.method = method;
try {
this.method.setAccessible(true);
} catch (SecurityException e) {
throw new SecurityException(e.getMessage(), e);
}
this.subCommand = subCommand;
this.description = description;
this.noTabComplete = noTabComplete;
@ -78,7 +83,6 @@ public class SubCommand<T> {
return false;
}
}
method.setAccessible(true);
method.invoke(abstractSWCommand, senderFunction.apply(sender));
} else {
List<Object> objects = new ArrayList<>();
@ -91,7 +95,6 @@ public class SubCommand<T> {
}
}
objects.add(0, senderFunction.apply(sender));
method.setAccessible(true);
method.invoke(abstractSWCommand, objects.toArray());
}
} catch (CommandNoHelpException e) {

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.command;
import de.steamwar.command.AbstractSWCommand.Register;
import de.steamwar.command.dto.ExecutionIdentifier;
import de.steamwar.command.dto.TestSWCommand;
@ -28,6 +29,11 @@ public class SimpleCommand extends TestSWCommand {
super("simple");
}
@Register(help = true)
public void test(String s, String... varargs) {
throw new ExecutionIdentifier("RunSimple with Varargs");
}
@Register
public void simple(String s) {
throw new ExecutionIdentifier("RunSimple with noArgs");

Datei anzeigen

@ -39,6 +39,16 @@ public class SimpleCommandTest {
}
}
@Test
public void testVarArgs() {
SimpleCommand cmd = new SimpleCommand();
try {
cmd.execute("test", "", new String[] {"a", "b", "c"});
} catch (Exception e) {
assertCMDFramework(e, ExecutionIdentifier.class, "RunSimple with Varargs");
}
}
@Test
public void testSimpleParsingNoResult() {
SimpleCommand cmd = new SimpleCommand();