forked from SteamWar/SteamWar
Add CommandFramework module
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar;
|
||||
|
||||
import de.steamwar.command.CommandFrameworkException;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
@UtilityClass
|
||||
public class AssertionUtils {
|
||||
|
||||
public static void assertCMDFramework(Exception e, Class<?> clazz, String message) {
|
||||
assertThat(e, is(instanceOf(CommandFrameworkException.class)));
|
||||
assertThat(e.getCause().getCause(), is(instanceOf(clazz)));
|
||||
assertThat(e.getCause().getCause().getMessage(), is(message));
|
||||
}
|
||||
|
||||
public static <T> void assertTabCompletes(List<T> list, T... elements) {
|
||||
assertThat(list.size(), is(elements.length));
|
||||
if (elements.length > 0) {
|
||||
assertThat(list, containsInAnyOrder(elements));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
|
||||
public class ArgumentCommand extends TestSWCommand {
|
||||
|
||||
public ArgumentCommand() {
|
||||
super("argument");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void argument(String sender, boolean b, boolean b2) {
|
||||
throw new ExecutionIdentifier("RunArgument with Boolean");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void argument(String sender, float f, float f2, float f3) {
|
||||
throw new ExecutionIdentifier("RunArgument with Float");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void argument(String sender, double d, double d2, double d3, double d4) {
|
||||
throw new ExecutionIdentifier("RunArgument with Double");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void argument(String sender, int i) {
|
||||
throw new ExecutionIdentifier("RunArgument with Integer");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void argument(String sender, long l, long l2) {
|
||||
throw new ExecutionIdentifier("RunArgument with Long");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void argument(String sender, String arg) {
|
||||
throw new ExecutionIdentifier("RunArgument with String");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void minLengthArgument(String sender, @Length(min = 3) @StaticValue({"he", "hello"}) String arg) {
|
||||
throw new ExecutionIdentifier("RunLengthArgument with String");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void minAndMaxLengthArgument(String sender, @Length(min = 3, max = 3) @StaticValue({"wo", "world"}) String arg) {
|
||||
throw new ExecutionIdentifier("RunLengthArgument with String");
|
||||
}
|
||||
|
||||
public void arrayLengthArgument(String sender, @ArrayLength(max = 3) @StaticValue({"one", "two", "three"}) String... args) {
|
||||
throw new ExecutionIdentifier("RunArrayLengthArgument with String");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.AssertionUtils.assertCMDFramework;
|
||||
import static de.steamwar.AssertionUtils.assertTabCompletes;
|
||||
|
||||
public class ArgumentCommandTest {
|
||||
|
||||
@Test
|
||||
public void testNoArgs() {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[0]);
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError("No exception expected");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBoolean() {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"true", "false"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Boolean");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFloat() {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"0.0", "0.0", "0.0"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Float");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDouble() {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"0.0", "0.0", "0.0", "0.0"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Double");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInt() {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"0"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Integer");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLong() {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"0", "0"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Long");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTabComplete() {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
List<String> strings = cmd.tabComplete("test", "", new String[]{""});
|
||||
assertTabCompletes(strings, "true", "false", "hello", "wor");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPartialTabComplete() {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
List<String> strings = cmd.tabComplete("test", "", new String[]{"t"});
|
||||
assertTabCompletes(strings, "true", "t");
|
||||
|
||||
strings = cmd.tabComplete("test", "", new String[]{"h"});
|
||||
assertTabCompletes(strings, "h", "hello");
|
||||
|
||||
strings = cmd.tabComplete("test", "", new String[]{"hel"});
|
||||
assertTabCompletes(strings, "hel", "hello");
|
||||
|
||||
strings = cmd.tabComplete("test", "", new String[]{"w"});
|
||||
assertTabCompletes(strings, "w", "wor");
|
||||
|
||||
strings = cmd.tabComplete("test", "", new String[]{"wor"});
|
||||
assertTabCompletes(strings, "wor");
|
||||
|
||||
strings = cmd.tabComplete("test", "", new String[]{"worl"});
|
||||
assertTabCompletes(strings, "wor", "worl");
|
||||
|
||||
strings = cmd.tabComplete("test", "", new String[]{"one", "two", "three", "one"});
|
||||
assertTabCompletes(strings);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
import de.steamwar.command.dto.TestTypeMapper;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class BetterExceptionCommand extends TestSWCommand {
|
||||
|
||||
public BetterExceptionCommand() {
|
||||
super("betterexception");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void exceptionOnTabComplete(String s, @Mapper("exception") @Validator("exception") String s1) {
|
||||
}
|
||||
|
||||
@Mapper("exception")
|
||||
@Validator("exception")
|
||||
public TestTypeMapper<String> tabCompleteException() {
|
||||
return new TestTypeMapper<String>() {
|
||||
@Override
|
||||
public String map(String sender, PreviousArguments previousArguments, String s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate(String sender, String value, MessageSender messageSender) {
|
||||
System.out.println("Validate: " + value);
|
||||
throw new SecurityException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(String sender, PreviousArguments previousArguments, String s) {
|
||||
throw new SecurityException();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class BetterExceptionCommandTest {
|
||||
|
||||
@Test
|
||||
public void testTabCompleteException() {
|
||||
BetterExceptionCommand cmd = new BetterExceptionCommand();
|
||||
try {
|
||||
cmd.tabComplete("test", "", new String[]{""});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertThat(e, is(instanceOf(CommandFrameworkException.class)));
|
||||
assertThat(e.getMessage(), is("de.steamwar.command.CommandFrameworkException: Error while tabcompleting () to type java.lang.String with parameter index 1"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidationException() {
|
||||
BetterExceptionCommand cmd = new BetterExceptionCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{""});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertThat(e, is(instanceOf(CommandFrameworkException.class)));
|
||||
assertThat(e.getMessage(), is("de.steamwar.command.CommandFrameworkException: Error while validating () to type java.lang.String with parameter index 1"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
import de.steamwar.command.dto.TestTypeMapper;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class CacheCommand extends TestSWCommand {
|
||||
|
||||
public CacheCommand() {
|
||||
super("typemapper");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void test(String sender, int tabCompleteTest) {
|
||||
}
|
||||
|
||||
private AtomicInteger count = new AtomicInteger();
|
||||
|
||||
@Cached
|
||||
@Mapper(value = "int", local = true)
|
||||
public AbstractTypeMapper<String, Integer> typeMapper() {
|
||||
return new TestTypeMapper<Integer>() {
|
||||
@Override
|
||||
public Integer map(String sender, PreviousArguments previousArguments, String s) {
|
||||
return Integer.parseInt(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(String sender, PreviousArguments previousArguments, String s) {
|
||||
return Arrays.asList(count.getAndIncrement() + "");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
public class CacheCommandTest {
|
||||
|
||||
@Test
|
||||
public void testCaching() {
|
||||
CacheCommand cmd = new CacheCommand();
|
||||
List<String> tabCompletions1 = cmd.tabComplete("test", "", new String[]{""});
|
||||
List<String> tabCompletions2 = cmd.tabComplete("test", "", new String[]{""});
|
||||
assertThat(tabCompletions1, is(equalTo(tabCompletions2)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCachingWithDifferentMessages() {
|
||||
CacheCommand cmd = new CacheCommand();
|
||||
List<String> tabCompletions1 = cmd.tabComplete("test", "", new String[]{""});
|
||||
List<String> tabCompletions2 = cmd.tabComplete("test", "", new String[]{"0"});
|
||||
assertThat(tabCompletions1, is(equalTo(tabCompletions2)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCachingWithDifferentSenders() {
|
||||
CacheCommand cmd = new CacheCommand();
|
||||
List<String> tabCompletions1 = cmd.tabComplete("test", "", new String[]{""});
|
||||
List<String> tabCompletions2 = cmd.tabComplete("test2", "", new String[]{""});
|
||||
assertThat(tabCompletions1, is(not(equalTo(tabCompletions2))));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
import de.steamwar.command.dto.TestTypeMapper;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class NullMapperCommand extends TestSWCommand {
|
||||
|
||||
public NullMapperCommand() {
|
||||
super("nullmapper");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void test(String sender, @AllowNull String arg) {
|
||||
if (arg == null) {
|
||||
throw new ExecutionIdentifier("null");
|
||||
}
|
||||
throw new ExecutionIdentifier("notnull");
|
||||
}
|
||||
|
||||
@ClassMapper(value = String.class, local = true)
|
||||
public TestTypeMapper<String> typeMapper() {
|
||||
return new TestTypeMapper<String>() {
|
||||
@Override
|
||||
public String map(String sender, PreviousArguments previousArguments, String s) {
|
||||
if (s.equals("Hello World")) {
|
||||
return null;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(String sender, PreviousArguments previousArguments, String s) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import org.junit.Test;
|
||||
|
||||
import static de.steamwar.AssertionUtils.assertCMDFramework;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class NullMapperCommandTest {
|
||||
|
||||
@Test
|
||||
public void testNull() {
|
||||
NullMapperCommand command = new NullMapperCommand();
|
||||
try {
|
||||
command.execute("test", "", new String[] {"Hello World"});
|
||||
assertThat(true, is(false));
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "null");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonNull() {
|
||||
NullMapperCommand command = new NullMapperCommand();
|
||||
try {
|
||||
command.execute("test", "", new String[] {"Hello"});
|
||||
assertThat(true, is(false));
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "notnull");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
|
||||
public class NumberValidatorCommand extends TestSWCommand {
|
||||
|
||||
public NumberValidatorCommand() {
|
||||
super("numberValidator");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void test(String sender, @Min(intValue = 0) @Max(intValue = 10) int i) {
|
||||
throw new ExecutionIdentifier("RunNumberValidator with int");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import org.junit.Test;
|
||||
|
||||
import static de.steamwar.AssertionUtils.assertCMDFramework;
|
||||
|
||||
public class NumberValidatorCommandTest {
|
||||
|
||||
@Test
|
||||
public void testMinValue() {
|
||||
NumberValidatorCommand command = new NumberValidatorCommand();
|
||||
command.execute("sender", "", new String[]{"-1"});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMaxValue() {
|
||||
NumberValidatorCommand command = new NumberValidatorCommand();
|
||||
command.execute("sender", "", new String[]{"11"});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidValue() {
|
||||
try {
|
||||
NumberValidatorCommand command = new NumberValidatorCommand();
|
||||
command.execute("sender", "", new String[]{"2"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunNumberValidator with int");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
import de.steamwar.command.dto.TestTypeMapper;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
public class PartOfCommand {
|
||||
|
||||
public static class ParentCommand extends TestSWCommand {
|
||||
|
||||
public ParentCommand() {
|
||||
super("parent");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void execute(String s, String... args) {
|
||||
throw new ExecutionIdentifier("ParentCommand with String...");
|
||||
}
|
||||
|
||||
@Mapper("test")
|
||||
public TestTypeMapper<Integer> typeMapper() {
|
||||
return new TestTypeMapper<Integer>() {
|
||||
@Override
|
||||
public Integer map(String sender, PreviousArguments previousArguments, String s) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(String sender, PreviousArguments previousArguments, String s) {
|
||||
return Arrays.asList(s);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@AbstractSWCommand.PartOf(ParentCommand.class)
|
||||
public static class SubCommand extends TestSWCommand {
|
||||
|
||||
public SubCommand() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void execute(String s, @Mapper("test") int i) {
|
||||
throw new ExecutionIdentifier("SubCommand with int " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import org.junit.Test;
|
||||
|
||||
import static de.steamwar.AssertionUtils.assertCMDFramework;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class PartOfCommandTest {
|
||||
|
||||
@Test
|
||||
public void testMerging() {
|
||||
PartOfCommand.ParentCommand command = new PartOfCommand.ParentCommand();
|
||||
new PartOfCommand.SubCommand();
|
||||
try {
|
||||
command.execute("test", "", new String[]{"0"});
|
||||
assertThat(true, is(false));
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "SubCommand with int -1");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
import de.steamwar.command.dto.TestTypeMapper;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
public class PreviousArgumentCommand extends TestSWCommand {
|
||||
|
||||
public PreviousArgumentCommand() {
|
||||
super("previous");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericCommand(String s, int i, String l) {
|
||||
throw new ExecutionIdentifier(l);
|
||||
}
|
||||
|
||||
@ClassMapper(value = String.class, local = true)
|
||||
public TestTypeMapper<String> typeMapper() {
|
||||
return new TestTypeMapper<String>() {
|
||||
@Override
|
||||
public String map(String sender, PreviousArguments previousArguments, String s) {
|
||||
return "RunTypeMapper_" + previousArguments.getMappedArg(0) + "_" + previousArguments.getMappedArg(0).getClass().getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(String sender, PreviousArguments previousArguments, String s) {
|
||||
return Arrays.asList(previousArguments.getMappedArg(0) + "");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.AssertionUtils.assertCMDFramework;
|
||||
import static de.steamwar.AssertionUtils.assertTabCompletes;
|
||||
|
||||
public class PreviousArgumentCommandTest {
|
||||
|
||||
@Test
|
||||
public void testPrevArg1() {
|
||||
PreviousArgumentCommand command = new PreviousArgumentCommand();
|
||||
List<String> strings = command.tabComplete("", "", new String[]{"1", ""});
|
||||
assertTabCompletes(strings, "1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrevArg2() {
|
||||
PreviousArgumentCommand command = new PreviousArgumentCommand();
|
||||
List<String> strings = command.tabComplete("", "", new String[]{"2", ""});
|
||||
assertTabCompletes(strings, "2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrevArgExecute() {
|
||||
PreviousArgumentCommand command = new PreviousArgumentCommand();
|
||||
try {
|
||||
command.execute("", "", new String[]{"2", "2"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunTypeMapper_2_Integer");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
|
||||
public class SimpleCommand extends TestSWCommand {
|
||||
|
||||
public SimpleCommand() {
|
||||
super("simple");
|
||||
}
|
||||
|
||||
@Register(value = "a", noTabComplete = 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");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.AssertionUtils.assertCMDFramework;
|
||||
import static de.steamwar.AssertionUtils.assertTabCompletes;
|
||||
|
||||
public class SimpleCommandTest {
|
||||
|
||||
@Test
|
||||
public void testSimpleParsing() {
|
||||
SimpleCommand cmd = new SimpleCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[0]);
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunSimple with noArgs");
|
||||
}
|
||||
}
|
||||
|
||||
@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();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"Hello"});
|
||||
} catch (CommandFrameworkException e) {
|
||||
throw new AssertionError("No exception expected");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleTabComplete() {
|
||||
SimpleCommand cmd = new SimpleCommand();
|
||||
List<String> strings = cmd.tabComplete("test", "", new String[]{""});
|
||||
assertTabCompletes(strings);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
|
||||
public class StaticValueCommand extends TestSWCommand {
|
||||
|
||||
public StaticValueCommand() {
|
||||
super("staticvalue");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void defaultStaticValue(String s, @StaticValue({"hello", "world"}) String staticValue) {
|
||||
throw new ExecutionIdentifier("RunStaticValue with " + staticValue);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void booleanStaticValue(String s, @StaticValue(value = {"-a", "-b", "-c"}, allowISE = true) boolean staticValue) {
|
||||
throw new ExecutionIdentifier("RunStaticValue with " + staticValue);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void booleanStaticValueOtherFalseValue(String s, @StaticValue(value = {"-d", "-e", "-f"}, allowISE = true, falseValues = { 1 }) boolean staticValue) {
|
||||
throw new ExecutionIdentifier("RunStaticValue with " + staticValue);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void intStaticValue(String s, @StaticValue(value = {"-g", "-h", "-i"}, allowISE = true) int staticValue) {
|
||||
throw new ExecutionIdentifier("RunStaticValue with int " + staticValue);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void longStaticValue(String s, @StaticValue(value = {"-j", "-k", "-l"}, allowISE = true) long staticValue) {
|
||||
throw new ExecutionIdentifier("RunStaticValue with long " + staticValue);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.AssertionUtils.assertCMDFramework;
|
||||
import static de.steamwar.AssertionUtils.assertTabCompletes;
|
||||
|
||||
public class StaticValueCommandTest {
|
||||
|
||||
@Test
|
||||
public void tabCompletionTest() {
|
||||
StaticValueCommand cmd = new StaticValueCommand();
|
||||
List<String> strings = cmd.tabComplete("", "", new String[]{""});
|
||||
assertTabCompletes(strings, "hello", "world", "-a", "-b", "-c", "-d", "-e", "-f", "-g", "-h", "-i", "-j", "-k", "-l");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultTest() {
|
||||
StaticValueCommand cmd = new StaticValueCommand();
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"hello"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with hello");
|
||||
}
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"world"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with world");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void booleanTest() {
|
||||
StaticValueCommand cmd = new StaticValueCommand();
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-a"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with false");
|
||||
}
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-b"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with true");
|
||||
}
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-c"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with true");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void booleanOtherFalseTest() {
|
||||
StaticValueCommand cmd = new StaticValueCommand();
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-d"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with true");
|
||||
}
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-e"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with false");
|
||||
}
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-f"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with true");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void intTest() {
|
||||
StaticValueCommand cmd = new StaticValueCommand();
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-g"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with int 0");
|
||||
}
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-h"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with int 1");
|
||||
}
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-i"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with int 2");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void longTest() {
|
||||
StaticValueCommand cmd = new StaticValueCommand();
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-j"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with long 0");
|
||||
}
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-k"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with long 1");
|
||||
}
|
||||
try {
|
||||
cmd.execute("", "", new String[] {"-l"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunStaticValue with long 2");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
import de.steamwar.command.dto.TestTypeMapper;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class SubCMDSortingCommand extends TestSWCommand {
|
||||
|
||||
public SubCMDSortingCommand() {
|
||||
super("subcmdsorting");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void test(String s) {
|
||||
throw new ExecutionIdentifier("Command with 0 parameters");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void test(String s, String args) {
|
||||
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
|
||||
public void test(String s, String... args) {
|
||||
throw new ExecutionIdentifier("Command with n parameters");
|
||||
}
|
||||
|
||||
@ClassMapper(value = String.class, local = true)
|
||||
public AbstractTypeMapper<String, String> stringMapper() {
|
||||
return SWCommandUtils.createMapper(s -> s, Collections::singletonList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import org.junit.Test;
|
||||
|
||||
import static de.steamwar.AssertionUtils.assertCMDFramework;
|
||||
|
||||
public class SubCMDSortingCommandTest {
|
||||
|
||||
@Test
|
||||
public void testNoArgs() {
|
||||
SubCMDSortingCommand cmd = new SubCMDSortingCommand();
|
||||
try {
|
||||
cmd.execute("", "", new String[]{});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "Command with 0 parameters");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOneArgs() {
|
||||
SubCMDSortingCommand cmd = new SubCMDSortingCommand();
|
||||
try {
|
||||
cmd.execute("", "", new String[]{"Hello"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "Command with 1 parameter");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOneArgsVarArg() {
|
||||
SubCMDSortingCommand cmd = new SubCMDSortingCommand();
|
||||
try {
|
||||
cmd.execute("", "", new String[]{"Hello", "World"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
|
||||
public class TypeMapperCommand extends TestSWCommand {
|
||||
|
||||
public TypeMapperCommand() {
|
||||
super("typemapper");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void test(String sender, String s) {
|
||||
throw new ExecutionIdentifier("RunTypeMapper with CustomMapper");
|
||||
}
|
||||
|
||||
@ClassMapper(value = String.class, local = true)
|
||||
public AbstractTypeMapper<String, String> getTypeMapper() {
|
||||
return SWCommandUtils.createMapper("1", "2", "3", "4", "5");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static de.steamwar.AssertionUtils.assertTabCompletes;
|
||||
|
||||
public class TypeMapperCommandTest {
|
||||
|
||||
@Test
|
||||
public void testTabComplete() {
|
||||
TypeMapperCommand cmd = new TypeMapperCommand();
|
||||
List<String> strings = cmd.tabComplete("test", "", new String[]{""});
|
||||
assertTabCompletes(strings, "1", "2", "3", "4", "5");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
import de.steamwar.command.dto.TestValidator;
|
||||
|
||||
public class ValidatorCommand extends TestSWCommand {
|
||||
|
||||
public ValidatorCommand() {
|
||||
super("testvalidator");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void test(@Validator String sender) {
|
||||
throw new ExecutionIdentifier("RunTest");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendMessage(String sender, String message, Object[] args) {
|
||||
if (message.equals("Hello World")) {
|
||||
throw new ExecutionIdentifier("RunSendMessageWithHelloWorldParameter");
|
||||
}
|
||||
}
|
||||
|
||||
@Register
|
||||
public void onError(String sender, @ErrorMessage("Hello World") int error) {
|
||||
System.out.println("onError: " + sender + " " + error);
|
||||
throw new ExecutionIdentifier("RunOnError");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void onError(String sender, double error) {
|
||||
System.out.println("onError: " + sender + " " + error);
|
||||
throw new ExecutionIdentifier("RunOnErrorDouble");
|
||||
}
|
||||
|
||||
@ClassValidator(value = String.class, local = true)
|
||||
public TestValidator<String> validator() {
|
||||
return (sender, value, messageSender) -> {
|
||||
throw new ExecutionIdentifier("RunValidator");
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import org.junit.Test;
|
||||
|
||||
import static de.steamwar.AssertionUtils.assertCMDFramework;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class ValidatorCommandTest {
|
||||
|
||||
@Test
|
||||
public void testValidator() {
|
||||
ValidatorCommand cmd = new ValidatorCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[0]);
|
||||
assertThat(true, is(false));
|
||||
} catch (Exception e) {
|
||||
assertThat(e.getMessage(), is("RunValidator"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testErrorMessage() {
|
||||
ValidatorCommand cmd = new ValidatorCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"Hello"});
|
||||
assertThat(true, is(false));
|
||||
} catch (Exception e) {
|
||||
assertThat(e.getMessage(), is("RunSendMessageWithHelloWorldParameter"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testErrorNoMessage() {
|
||||
ValidatorCommand cmd = new ValidatorCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"0.0"});
|
||||
assertThat(true, is(false));
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunOnErrorDouble");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvert() {
|
||||
ValidatorInvertCommand cmd = new ValidatorInvertCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"false", "true"});
|
||||
assertThat(true, is(false));
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunTestInvert");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvertOther() {
|
||||
ValidatorInvertCommand cmd = new ValidatorInvertCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"Hello", "0"});
|
||||
assertThat(true, is(false));
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunTestInvert2");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command;
|
||||
|
||||
import de.steamwar.command.dto.ExecutionIdentifier;
|
||||
import de.steamwar.command.dto.TestSWCommand;
|
||||
import de.steamwar.command.dto.TestValidator;
|
||||
|
||||
public class ValidatorInvertCommand extends TestSWCommand {
|
||||
|
||||
public ValidatorInvertCommand() {
|
||||
super("testvalidator");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void test(@Validator(value = "Text", invert = true) String sender, boolean b, boolean b2) {
|
||||
System.out.println("test: " + sender + " " + b + " " + b2);
|
||||
throw new ExecutionIdentifier("RunTestInvert");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void test(String sender, @Validator(value = "Text", invert = true) String h, int i) {
|
||||
System.out.println("test: " + sender + " " + h + " " + i);
|
||||
throw new ExecutionIdentifier("RunTestInvert2");
|
||||
}
|
||||
|
||||
@Validator(value = "Text", local = true)
|
||||
public TestValidator<String> testValidator() {
|
||||
return (sender, value, messageSender) -> {
|
||||
System.out.println("testValidator: " + sender + " " + value + " " + messageSender);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command.dto;
|
||||
|
||||
public class ExecutionIdentifier extends RuntimeException {
|
||||
public ExecutionIdentifier(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command.dto;
|
||||
|
||||
import de.steamwar.command.AbstractSWCommand;
|
||||
import de.steamwar.command.CommandFrameworkException;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class TestSWCommand extends AbstractSWCommand<String> {
|
||||
|
||||
protected TestSWCommand(String command) {
|
||||
super(String.class, command);
|
||||
}
|
||||
|
||||
protected TestSWCommand(String command, String[] aliases) {
|
||||
super(String.class, command, aliases);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createAndSafeCommand(String command, String[] aliases) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void commandSystemError(String sender, CommandFrameworkException e) {
|
||||
System.out.println("CommandSystemError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void commandSystemWarning(Supplier<String> message) {
|
||||
System.out.println("CommandSystemWarning: " + message.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command.dto;
|
||||
|
||||
import de.steamwar.command.AbstractTypeMapper;
|
||||
|
||||
public interface TestTypeMapper<T> extends AbstractTypeMapper<String, T> {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.command.dto;
|
||||
|
||||
import de.steamwar.command.AbstractValidator;
|
||||
|
||||
public interface TestValidator<T> extends AbstractValidator<String, T> {
|
||||
}
|
||||
Reference in New Issue
Block a user