Translate extends MouseAdapter { @Override public void mouseClicked(final MouseEvent event) { this.drawable.translate(this.xtrans, this.ytrans); this.drawable.repaint(); } Translate(final double xtrans, final double ytrans,
        final AwtDrawableSurface drawable); @Override void mouseClicked(final MouseEvent event);  }
@Test public void translatesCenter() { final AwtDrawableSurface surface = new AwtDrawableSurface(); final DblPoint center = surface.context().center(); final Double xcoor = center.dblx(); final Double ycoor = center.dbly(); final double amountx = Math.random(); final double amounty = Math.random(); final Translate mouse = new Translate(amountx, amounty, surface); mouse.mouseClicked(Mockito.mock(MouseEvent.class)); MatcherAssert.assertThat( surface.context().center(), Matchers.equalTo(new DblPoint(xcoor + amountx, ycoor + amounty)) ); }