### Question:
GameLoop implements Runnable { public void singleRunOnlyUpdateGameView() { if (lastInvocation == 0) { lastInvocation = System.currentTimeMillis(); return; } long theCurrentTime = System.currentTimeMillis(); long theGameTime = theCurrentTime - statistics.getStartTime(); long theElapsedTime = theCurrentTime - lastInvocation; if (theElapsedTime > 0) { try { long theNumberOfTicks = statistics.incrementTicks(); statistics.beginGameLoop(); for (GameView theView : gameViews) { theView.renderGame(theGameTime, theElapsedTime, scene, statistics); } lastInvocation = theCurrentTime; } catch (Exception e) { runtime.getEventManager().fire(new SystemException(e)); } finally { statistics.endGameLoop(); } } } GameLoop(GameScene aScene, GameView aHumanGameView, GameRuntime aRuntime); void addGameView(GameView aNewGameView); GameView getHumanGameView(); GameScene getScene(); @Override void run(); void singleRunOnlyUpdateGameView(); void singleRun(); void shutdown(); boolean isShutdown();  }### Answer:
@Test public void testSingleRunOnlyUpdateGameView() throws Exception { GameScene theScene = mock(GameScene.class); GameView theGameView = mock(GameView.class); GameRuntime theRuntime = mock(GameRuntime.class); GameLoop theLoop = new GameLoop(theScene, theGameView, theRuntime); theLoop.singleRunOnlyUpdateGameView(); Thread.sleep(10); theLoop.singleRunOnlyUpdateGameView(); verify(theGameView).renderGame(anyLong(), anyLong(), eq(theScene), any(RuntimeStatistics.class)); assertEquals(1, theLoop.getStatistics().getNumberTicks()); }
@Test public void testSingleRunOnlyUpdateGameViewError() throws Exception { GameScene theScene = mock(GameScene.class); GameView theGameView = mock(GameView.class); doThrow(new RuntimeException()).when(theGameView).renderGame(anyLong(), anyLong(), eq(theScene), any(RuntimeStatistics.class)); GameRuntime theRuntime = mock(GameRuntime.class); GameEventManager theManager = mock(GameEventManager.class); when(theRuntime.getEventManager()).thenReturn(theManager); GameLoop theLoop = new GameLoop(theScene, theGameView, theRuntime); theLoop.singleRunOnlyUpdateGameView(); Thread.sleep(10); theLoop.singleRunOnlyUpdateGameView(); verify(theManager).fire(any(SystemException.class)); }