Created
April 3, 2021 19:13
-
-
Save hugmanrique/38a46adb8a812bb2e2d692a277e03c7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paste in src/test/java/com/mojang/brigadier/CommandDispatcherTest.java | |
@SuppressWarnings("unchecked") | |
@Test | |
public void testExecuteAmbiguousArgumentImpermissibleLiteral() throws Exception { | |
final Command<Object> command = mock(Command.class); | |
when(command.run(any())).thenReturn(100); | |
subject.register(literal("foo") | |
.then( | |
literal("bar") | |
.requires(source -> false) | |
) | |
.then( | |
argument("argument", StringArgumentType.word()) | |
.executes(command) | |
) | |
); | |
assertThat(subject.execute("foo bar", source), is(100)); | |
verify(command).run(any(CommandContext.class)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment