@Test public void testClick() { final BallThread ballThread = mock(BallThread.class); final BallItem ballItem = new BallItem(); ballItem.setTwin(ballThread); final InOrder inOrder = inOrder(ballThread); for (int i = 0; i < 10; i++) { ballItem.click(); inOrder.verify(ballThread).suspendMe(); ballItem.click(); inOrder.verify(ballThread).resumeMe(); } inOrder.verifyNoMoreInteractions(); }
@Override public void click() { isSuspended = !isSuspended; if (isSuspended) { twin.suspendMe(); } else { twin.resumeMe(); } }
BallItem extends GameItem { @Override public void click() { isSuspended = !isSuspended; if (isSuspended) { twin.suspendMe(); } else { twin.resumeMe(); } } }
BallItem extends GameItem { @Override public void click() { isSuspended = !isSuspended; if (isSuspended) { twin.suspendMe(); } else { twin.resumeMe(); } }  }
BallItem extends GameItem { @Override public void click() { isSuspended = !isSuspended; if (isSuspended) { twin.suspendMe(); } else { twin.resumeMe(); } }  void setTwin(BallThread twin); @Override void doDraw(); void move(); @Override void click(); }
BallItem extends GameItem { @Override public void click() { isSuspended = !isSuspended; if (isSuspended) { twin.suspendMe(); } else { twin.resumeMe(); } }  void setTwin(BallThread twin); @Override void doDraw(); void move(); @Override void click();  }