use of org.kie.workbench.common.stunner.core.command.CommandManager in project kie-wb-common by kiegroup.
the class RedoCommandHandlerTest method testExecuteOnNull.
@Test(expected = IllegalStateException.class)
@SuppressWarnings("unchecked")
public void testExecuteOnNull() {
Object obj = mock(Object.class);
CommandManager manager = mock(CommandManager.class);
when(registryFactory.newCommandRegistry()).thenReturn(commandRegistry);
when(commandRegistry.isEmpty()).thenReturn(true);
tested = new RedoCommandHandler(registryFactory);
tested.execute(obj, manager);
}
use of org.kie.workbench.common.stunner.core.command.CommandManager in project kie-wb-common by kiegroup.
the class RedoCommandHandlerTest method testExecute.
@Test
@SuppressWarnings("unchecked")
public void testExecute() {
Object obj = mock(Object.class);
CommandManager manager = mock(CommandManager.class);
CommandResult expectedResult = mock(CommandResult.class);
when(commandRegistry.peek()).thenReturn(command1);
when(manager.execute(obj, command1)).thenReturn(expectedResult);
CommandResult actualResult = tested.execute(obj, manager);
assertEquals(expectedResult, actualResult);
verify(manager).execute(eq(obj), eq(command1));
}
Aggregations