@Test public void testGetMouseUpHandler() { final MouseUpHandler handler = abstractDragProxy.getMouseUpHandler(callback); final int expectedX = 175; final int expectedY = 175; when(mouseUpEvent.getX()).thenReturn(150); when(mouseUpEvent.getY()).thenReturn(150); doReturn(25).when(abstractDragProxy).getXDiff(); doReturn(25).when(abstractDragProxy).getYDiff(); doNothing().when(abstractDragProxy).clear(); doReturn(true).when(abstractDragProxy).isAttached(); handler.onMouseUp(mouseUpEvent); verify(abstractDragProxy).clear(); verify(callback).onComplete(expectedX, expectedY); }
MouseUpHandler getMouseUpHandler(final Callback callback) { return mouseUpEvent -> { if (isAttached()) { timer.cancel(); final int x = relativeX(getXDiff() + mouseUpEvent.getX()); final int y = relativeY(getYDiff() + mouseUpEvent.getY()); clear(); callback.onComplete(x, y); } }; }
AbstractDragProxy { MouseUpHandler getMouseUpHandler(final Callback callback) { return mouseUpEvent -> { if (isAttached()) { timer.cancel(); final int x = relativeX(getXDiff() + mouseUpEvent.getX()); final int y = relativeY(getYDiff() + mouseUpEvent.getY()); clear(); callback.onComplete(x, y); } }; } }
AbstractDragProxy { MouseUpHandler getMouseUpHandler(final Callback callback) { return mouseUpEvent -> { if (isAttached()) { timer.cancel(); final int x = relativeX(getXDiff() + mouseUpEvent.getX()); final int y = relativeY(getYDiff() + mouseUpEvent.getY()); clear(); callback.onComplete(x, y); } }; } AbstractDragProxy(final Layer layer,
                             final T shape,
                             final int x,
                             final int y,
                             final int timeout,
                             final Callback callback); }
AbstractDragProxy { MouseUpHandler getMouseUpHandler(final Callback callback) { return mouseUpEvent -> { if (isAttached()) { timer.cancel(); final int x = relativeX(getXDiff() + mouseUpEvent.getX()); final int y = relativeY(getYDiff() + mouseUpEvent.getY()); clear(); callback.onComplete(x, y); } }; } AbstractDragProxy(final Layer layer,
                             final T shape,
                             final int x,
                             final int y,
                             final int timeout,
                             final Callback callback); void clear(); void destroy(); }
AbstractDragProxy { MouseUpHandler getMouseUpHandler(final Callback callback) { return mouseUpEvent -> { if (isAttached()) { timer.cancel(); final int x = relativeX(getXDiff() + mouseUpEvent.getX()); final int y = relativeY(getYDiff() + mouseUpEvent.getY()); clear(); callback.onComplete(x, y); } }; } AbstractDragProxy(final Layer layer,
                             final T shape,
                             final int x,
                             final int y,
                             final int timeout,
                             final Callback callback); void clear(); void destroy();  }