### Question:
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();  }### Answer:
@Test public void testClick() { final var ballThread = mock(BallThread.class); final var ballItem = new BallItem(); ballItem.setTwin(ballThread); final var inOrder = inOrder(ballThread); IntStream.range(0, 10).forEach(i -> { ballItem.click(); inOrder.verify(ballThread).suspendMe(); ballItem.click(); inOrder.verify(ballThread).resumeMe(); }); inOrder.verifyNoMoreInteractions(); }
@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(); }