Search in sources :

Example 1 with Consumer

use of com.ait.tooling.common.api.java.util.function.Consumer in project kie-wb-common by kiegroup.

the class WiresConnectorViewExtTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
    HEAD_DECORATOR = new MultiPathDecorator(new MultiPath().rect(0, 0, 10, 10));
    TAIL_DECORATOR = new MultiPathDecorator(new MultiPath().rect(0, 0, 10, 10));
    POINTS = new Point2DArray(new Point2D(0, 10), new Point2D(10, 10), new Point2D(20, 20), new Point2D(30, 30), new Point2D(40, 40));
    line = new PolyLine(POINTS);
    layer = spy(new Layer());
    doAnswer(invocation -> {
        ((Consumer) invocation.getArguments()[0]).accept(labelText);
        return label;
    }).when(label).configure(any(Consumer.class));
    tested = spy(new WiresConnectorViewExt(ShapeViewSupportedEvents.DESKTOP_CONNECTOR_EVENT_TYPES, line, HEAD_DECORATOR, TAIL_DECORATOR) {

        @Override
        protected Optional<WiresConnectorLabel> createLabel(String title) {
            return Optional.of(WiresConnectorViewExtTest.this.label);
        }
    });
    tested.setControl(connectorControl);
    layer.add(tested.getGroup());
}
Also used : Point2DArray(com.ait.lienzo.client.core.types.Point2DArray) MultiPath(com.ait.lienzo.client.core.shape.MultiPath) WiresConnectorLabel(com.ait.lienzo.client.core.shape.wires.util.WiresConnectorLabel) Consumer(com.ait.tooling.common.api.java.util.function.Consumer) Point2D(com.ait.lienzo.client.core.types.Point2D) MultiPathDecorator(com.ait.lienzo.client.core.shape.MultiPathDecorator) PolyLine(com.ait.lienzo.client.core.shape.PolyLine) Layer(com.ait.lienzo.client.core.shape.Layer) Before(org.junit.Before)

Aggregations

Layer (com.ait.lienzo.client.core.shape.Layer)1 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1 MultiPathDecorator (com.ait.lienzo.client.core.shape.MultiPathDecorator)1 PolyLine (com.ait.lienzo.client.core.shape.PolyLine)1 WiresConnectorLabel (com.ait.lienzo.client.core.shape.wires.util.WiresConnectorLabel)1 Point2D (com.ait.lienzo.client.core.types.Point2D)1 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)1 Consumer (com.ait.tooling.common.api.java.util.function.Consumer)1 Before (org.junit.Before)1