use of com.ait.lienzo.client.core.shape.wires.ILocationAcceptor in project kie-wb-common by kiegroup.
the class LocationControlImplTest method testLocationAcceptor.
@Test
@SuppressWarnings("unchecked")
public void testLocationAcceptor() {
tested.enable(canvasHandler);
tested.register(element);
ArgumentCaptor<ILocationAcceptor> locationAcceptorArgumentCaptor = ArgumentCaptor.forClass(ILocationAcceptor.class);
verify(wiresManager, times(1)).setLocationAcceptor(locationAcceptorArgumentCaptor.capture());
final ILocationAcceptor locationAcceptor = locationAcceptorArgumentCaptor.getValue();
final WiresShapeView wiresContainer = mock(WiresShapeView.class);
when(wiresContainer.getUUID()).thenReturn(ELEMENT_UUID);
final com.ait.lienzo.client.core.types.Point2D point = new com.ait.lienzo.client.core.types.Point2D(40d, 50d);
locationAcceptor.accept(new WiresContainer[] { wiresContainer }, new com.ait.lienzo.client.core.types.Point2D[] { point });
ArgumentCaptor<CanvasCommand> commandArgumentCaptor = ArgumentCaptor.forClass(CanvasCommand.class);
verify(commandManager, times(1)).execute(eq(canvasHandler), commandArgumentCaptor.capture());
final UpdateElementPositionCommand command = (UpdateElementPositionCommand) commandArgumentCaptor.getValue();
assertEquals(element, command.getElement());
assertEquals(new Point2D(40d, 50d), command.getLocation());
}
Aggregations