Search in sources :

Example 1 with MethodCommand

use of org.terasology.logic.console.commandSystem.MethodCommand in project Terasology by MovingBlocks.

the class ComponentSystemManagerTest method shouldRegisterCommandWithoutSenderAnnotation.

@Test
public void shouldRegisterCommandWithoutSenderAnnotation() {
    // see https://github.com/MovingBlocks/Terasology/issues/2679
    systemUnderTest.register(new SystemWithCommandMissingSenderAnnotation());
    systemUnderTest.initialise();
    ArgumentCaptor<MethodCommand> methodCommandArgumentCaptor = ArgumentCaptor.forClass(MethodCommand.class);
    verify(console).registerCommand(methodCommandArgumentCaptor.capture());
    MethodCommand command = methodCommandArgumentCaptor.getValue();
    assertThat(command.getName().toString(), is("commandWithoutSenderAnnotation"));
}
Also used : MethodCommand(org.terasology.logic.console.commandSystem.MethodCommand) Test(org.junit.Test)

Example 2 with MethodCommand

use of org.terasology.logic.console.commandSystem.MethodCommand in project Terasology by MovingBlocks.

the class ComponentSystemManagerTest method shouldRegisterCommand.

@Test
public void shouldRegisterCommand() {
    systemUnderTest.register(new SystemWithValidCommand());
    systemUnderTest.initialise();
    ArgumentCaptor<MethodCommand> methodCommandArgumentCaptor = ArgumentCaptor.forClass(MethodCommand.class);
    verify(console).registerCommand(methodCommandArgumentCaptor.capture());
    MethodCommand command = methodCommandArgumentCaptor.getValue();
    assertThat(command.getName().toString(), is("validCommandName"));
}
Also used : MethodCommand(org.terasology.logic.console.commandSystem.MethodCommand) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 MethodCommand (org.terasology.logic.console.commandSystem.MethodCommand)2