### Question:
LoopExtrapolated implements Loop { @Override public void start(Screen screen, Frame frame) { Check.notNull(screen); Check.notNull(frame); final Config config = screen.getConfig(); final Resolution output = config.getOutput(); final boolean sync = config.isWindowed() && output.getRate() > 0; notifyRateChanged(output.getRate()); double extrp = 1.0; isRunning = true; while (isRunning) { if (screen.isReady()) { final long lastTime = System.nanoTime(); frame.update(extrp); screen.preUpdate(); frame.render(); screen.update(); while (sync && System.nanoTime() - lastTime < maxFrameTimeNano) { Thread.yield(); } final long currentTime = Math.max(lastTime + 1L, System.nanoTime()); extrp = rate / ONE_SECOND_IN_NANO * (currentTime - lastTime); frame.computeFrameRate(lastTime, currentTime); } else { frame.check(); UtilSequence.pause(Constant.DECADE); } } } LoopExtrapolated(); @Override void start(Screen screen, Frame frame); @Override void stop(); @Override void notifyRateChanged(int rate);  }### Answer:
@Test void testLoop() { ScreenMock.setScreenWait(false); final Screen screen = new ScreenMock(new Config(new Resolution(320, 240, 50), 16, true)); final Thread thread = getTask(screen); thread.start(); assertTimeout(1000L, thread::join); assertEquals(maxTick.get(), tick.get()); assertEquals(tick.get(), rendered.get()); assertTrue(extrapolation.get().doubleValue() > 0.0, String.valueOf(extrapolation.get().doubleValue())); final int expectedRate = screen.getConfig().getOutput().getRate(); assertTrue(computed.get() <= expectedRate, String.valueOf(computed.get())); }
@Test void testNoSync() { ScreenMock.setScreenWait(false); final Screen screen = new ScreenMock(new Config(new Resolution(320, 240, 0), 16, true)); final Thread thread = getTask(screen); thread.start(); assertTimeout(1000L, thread::join); assertEquals(maxTick.get(), tick.get()); assertEquals(tick.get(), rendered.get()); assertTrue(extrapolation.get().doubleValue() < 0.1, String.valueOf(extrapolation.get())); final int expectedRate = screen.getConfig().getOutput().getRate(); assertTrue(computed.get() > expectedRate, String.valueOf(computed.get())); }