✅ Add more tests for ambiguous command registration
Also clean up after leaving the Command Tree in an invalid state during tests
This commit is contained in:
parent
7df6917fe4
commit
e9134efad6
1 changed files with 20 additions and 0 deletions
|
|
@ -291,12 +291,32 @@ class CommandTreeTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testAmbiguousNodes() {
|
void testAmbiguousNodes() {
|
||||||
|
// Call newTree(); after each time we leave the Tree in an invalid state
|
||||||
manager.command(manager.commandBuilder("ambiguous")
|
manager.command(manager.commandBuilder("ambiguous")
|
||||||
.argument(StringArgument.of("string"))
|
.argument(StringArgument.of("string"))
|
||||||
);
|
);
|
||||||
Assertions.assertThrows(AmbiguousNodeException.class, () ->
|
Assertions.assertThrows(AmbiguousNodeException.class, () ->
|
||||||
manager.command(manager.commandBuilder("ambiguous")
|
manager.command(manager.commandBuilder("ambiguous")
|
||||||
.argument(IntegerArgument.of("integer"))));
|
.argument(IntegerArgument.of("integer"))));
|
||||||
|
newTree();
|
||||||
|
|
||||||
|
manager.command(manager.commandBuilder("ambiguous")
|
||||||
|
.argument(StringArgument.of("string"))
|
||||||
|
);
|
||||||
|
Assertions.assertThrows(AmbiguousNodeException.class, () ->
|
||||||
|
manager.command(manager.commandBuilder("ambiguous")
|
||||||
|
.literal("literal")));
|
||||||
|
newTree();
|
||||||
|
|
||||||
|
manager.command(manager.commandBuilder("ambiguous")
|
||||||
|
.literal("literal")
|
||||||
|
);
|
||||||
|
manager.command(manager.commandBuilder("ambiguous")
|
||||||
|
.literal("literal2"));
|
||||||
|
Assertions.assertThrows(AmbiguousNodeException.class, () ->
|
||||||
|
manager.command(manager.commandBuilder("ambiguous")
|
||||||
|
.argument(IntegerArgument.of("integer"))));
|
||||||
|
newTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue