✅ Add a test for ambiguous command registration
This commit is contained in:
parent
5e27148d82
commit
f1cc2689a0
1 changed files with 11 additions and 0 deletions
|
|
@ -31,6 +31,7 @@ import cloud.commandframework.arguments.standard.FloatArgument;
|
||||||
import cloud.commandframework.arguments.standard.IntegerArgument;
|
import cloud.commandframework.arguments.standard.IntegerArgument;
|
||||||
import cloud.commandframework.arguments.standard.StringArgument;
|
import cloud.commandframework.arguments.standard.StringArgument;
|
||||||
import cloud.commandframework.context.CommandContext;
|
import cloud.commandframework.context.CommandContext;
|
||||||
|
import cloud.commandframework.exceptions.AmbiguousNodeException;
|
||||||
import cloud.commandframework.exceptions.NoPermissionException;
|
import cloud.commandframework.exceptions.NoPermissionException;
|
||||||
import cloud.commandframework.meta.SimpleCommandMeta;
|
import cloud.commandframework.meta.SimpleCommandMeta;
|
||||||
import cloud.commandframework.types.tuples.Pair;
|
import cloud.commandframework.types.tuples.Pair;
|
||||||
|
|
@ -288,6 +289,16 @@ class CommandTreeTest {
|
||||||
manager.executeCommand(new TestCommandSender(), "flags -tf --num 63 --enum potato").join();
|
manager.executeCommand(new TestCommandSender(), "flags -tf --num 63 --enum potato").join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testAmbiguousNodes() {
|
||||||
|
manager.command(manager.commandBuilder("ambiguous")
|
||||||
|
.argument(StringArgument.of("string"))
|
||||||
|
);
|
||||||
|
Assertions.assertThrows(AmbiguousNodeException.class, () ->
|
||||||
|
manager.command(manager.commandBuilder("ambiguous")
|
||||||
|
.argument(IntegerArgument.of("integer"))));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDuplicateArgument() {
|
void testDuplicateArgument() {
|
||||||
final CommandArgument<TestCommandSender, String> argument = StringArgument.of("test");
|
final CommandArgument<TestCommandSender, String> argument = StringArgument.of("test");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue