use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class GroupItemTest method testHide.
@Test
public void testHide() {
when(group.getAlpha()).thenReturn(1d);
final Command before = mock(Command.class);
final Command after = mock(Command.class);
tested.hide(before, after);
verify(before, times(1)).execute();
verify(hideExecutor, times(1)).accept(eq(group), eq(after));
verify(showExecutor, never()).accept(any(Group.class), any(Command.class));
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class ButtonGridItemImplTest method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() {
buttonGroup = spy(new Group().setAlpha(0d));
toolboxGroup = spy(new Group());
when(buttonGroup.getComputedBoundingPoints()).thenReturn(buttonBoundingPoints);
when(buttonGroup.getBoundingBox()).thenReturn(buttonBoundingBox);
when(buttonBoundingPoints.getBoundingBox()).thenReturn(buttonBoundingBox);
when(toolboxGroup.getComputedBoundingPoints()).thenReturn(toolboxBoundingPoints);
when(toolboxGroup.getBoundingBox()).thenReturn(toolboxBoundingBox);
when(toolboxBoundingPoints.getBoundingBox()).thenReturn(toolboxBoundingBox);
when(button.getBoundingBox()).thenReturn(() -> buttonBoundingBox);
when(button.asPrimitive()).thenReturn(buttonGroup);
when(button.getPrimitive()).thenReturn(mock(IPrimitive.class));
when(button.getWrapped()).thenReturn(buttonWrap);
when(buttonWrap.registrations()).thenReturn(registrations);
when(buttonWrap.asPrimitive()).thenReturn(buttonGroup);
when(buttonWrap.getBoundingBox()).thenReturn(() -> buttonBoundingBox);
when(toolbox.getBoundingBox()).thenReturn(() -> toolboxBoundingBox);
when(toolbox.asPrimitive()).thenReturn(toolboxGroup);
when(toolbox.getPrimitive()).thenReturn(mock(IPrimitive.class));
when(toolbox.getAt()).thenReturn(Direction.SOUTH_EAST);
when(toolbox.getWrapped()).thenReturn(toolboxWrap);
when(toolboxWrap.asPrimitive()).thenReturn(toolboxGroup);
when(toolboxWrap.getBoundingBox()).thenReturn(() -> toolboxBoundingBox);
when(button1.getPrimitive()).thenReturn(button1Prim);
doAnswer(invocationOnMock -> {
((Command) invocationOnMock.getArguments()[0]).execute();
((Command) invocationOnMock.getArguments()[1]).execute();
return button;
}).when(button).show(any(Command.class), any(Command.class));
doAnswer(invocationOnMock -> {
((Command) invocationOnMock.getArguments()[0]).execute();
((Command) invocationOnMock.getArguments()[1]).execute();
return button;
}).when(button).hide(any(Command.class), any(Command.class));
doAnswer(invocationOnMock -> {
((Command) invocationOnMock.getArguments()[0]).execute();
((Command) invocationOnMock.getArguments()[1]).execute();
return toolbox;
}).when(toolbox).show(any(Command.class), any(Command.class));
doAnswer(invocationOnMock -> {
((Command) invocationOnMock.getArguments()[0]).execute();
((Command) invocationOnMock.getArguments()[1]).execute();
return toolbox;
}).when(toolbox).hide(any(Command.class), any(Command.class));
tested = new ButtonGridItemImpl(button, toolbox).useHideExecutor(hideExecutor).useShowExecutor(showExecutor);
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class ButtonGridItemImplTest method testShow.
@Test
public void testShow() {
final Command before = mock(Command.class);
final Command after = mock(Command.class);
tested.show(before, after);
verify(button, times(1)).show(eq(before), eq(after));
verify(button, never()).hide(any(Command.class), any(Command.class));
verify(toolbox, never()).hide(any(Command.class), any(Command.class));
verify(toolbox, never()).hide(any(Command.class), any(Command.class));
verify(before, times(1)).execute();
verify(after, times(1)).execute();
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class ButtonItemImplTest method testShow.
@Test
public void testShow() {
final Command before = mock(Command.class);
final Command after = mock(Command.class);
tested.show(before, after);
verify(groupItem, times(1)).show(eq(before), eq(after));
verify(groupItem, never()).hide(any(Command.class), any(Command.class));
verify(before, times(1)).execute();
verify(after, times(1)).execute();
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class FocusableGroupTest method testShow.
@Test
public void testShow() {
final Command before = mock(Command.class);
final Command after = mock(Command.class);
tested.show(before, after);
verify(groupItem, times(1)).show(any(Command.class), eq(after));
verify(groupItem, never()).hide(any(Command.class), any(Command.class));
verify(before, times(1)).execute();
verify(after, times(1)).execute();
}
Aggregations