ImplementationPlatformReaper extends Thread { @Override public void run() { LOGGER.info("implementation platform reaper started with a delay of " + reapingDelay + " msecs"); synchronized (lock) { try { lock.wait(reapingDelay); if (!stopReaping) { LOGGER.info("delay exceeded: cleaning up"); forceReturnResources(); } } catch (InterruptedException e) { return; } } LOGGER.info("reaper stopped"); } ImplementationPlatformReaper(
            final JVoiceXmlImplementationPlatform impl, final JVoiceXmlUserInput in,
            final JVoiceXmlSystemOutput out); void setReapingDelay(final long delay); @Override void run(); void stopReaping();  }
@Test public void testRun() throws InterruptedException { final JVoiceXmlImplementationPlatform platform = new JVoiceXmlImplementationPlatform(null, null, null, null); final Session session = Mockito.mock(Session.class); Mockito.when(session.getSessionId()).thenReturn("42"); platform.setSession(session); final ImplementationPlatformReaper reaper = new ImplementationPlatformReaper(platform, null, null); final long delay = 200; reaper.setReapingDelay(delay); reaper.start(); Thread.sleep(delay + 100); }