Search in sources :

Example 1 with MethodCommand

use of org.terasology.engine.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();
    assertEquals(command.getName().toString(), "validCommandName");
}
Also used : MethodCommand(org.terasology.engine.logic.console.commandSystem.MethodCommand) Test(org.junit.jupiter.api.Test)

Example 2 with MethodCommand

use of org.terasology.engine.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();
    assertEquals(command.getName().toString(), "commandWithoutSenderAnnotation");
}
Also used : MethodCommand(org.terasology.engine.logic.console.commandSystem.MethodCommand) Test(org.junit.jupiter.api.Test)

Aggregations

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