GridLienzoScrollHandler { RestrictedMousePanMediator makeRestrictedMousePanMediator() { return new RestrictedMousePanMediator() { @Override protected void onMouseMove(final NodeMouseMoveEvent event) { refreshScrollPosition(); } @Override protected Viewport getLayerViewport() { return getViewport(); } }; } GridLienzoScrollHandler(final GridLienzoPanel panel); void init(); Integer scrollbarWidth(); Integer scrollbarHeight(); void refreshScrollPosition(); void setBounds(final Bounds bounds);  }
@Test public void testMakeRestrictedMousePanMediator() { final Viewport viewport = viewportMock(); final DefaultGridLayer defaultGridLayer = mock(DefaultGridLayer.class); final RestrictedMousePanMediator restrictedMousePanMediator = spy(gridLienzoScrollHandler.makeRestrictedMousePanMediator()); doNothing().when(gridLienzoScrollHandler).refreshScrollPosition(); doReturn(viewport).when(restrictedMousePanMediator).getViewport(); doReturn(defaultGridLayer).when(gridLienzoScrollHandler).getDefaultGridLayer(); doReturn(viewport).when(defaultGridLayer).getViewport(); restrictedMousePanMediator.handleEvent(mouseDownEventMock()); restrictedMousePanMediator.handleEvent(mouseMoveEventMock()); verify(gridLienzoScrollHandler).refreshScrollPosition(); }