ReleaseCheckService extends AbstractScheduledService implements Service { @Inject public ReleaseCheckService(final VersionManager versionManager, final ConfigurationManager configurationManager) { this.versionManager = versionManager; this.checkDelayHours = configurationManager.getParameter(RELEASE_CHECK_DELAY_HOURS); } @Inject  ReleaseCheckService(final VersionManager versionManager, final ConfigurationManager configurationManager); @Override void start(); @Override void stop();  }
@Test public void testReleaseCheckService() { VersionManager versionManager = createMock(VersionManager.class); ConfigurationManager configurationManager = createMock(ConfigurationManager.class); expect(configurationManager.getParameter(RELEASE_CHECK_DELAY_HOURS)).andReturn(1); versionManager.updateRemoteReleaseInfo(); expectLastCall().atLeastOnce(); replay(versionManager, configurationManager); ReleaseCheckServiceTester service = new ReleaseCheckServiceTester(versionManager, configurationManager); try { service.start(); service.awaitRunning(10, SECONDS); service.run(); } catch (TimeoutException e) { fail(e.getMessage()); } finally { verify(versionManager, configurationManager); if (service.isRunning()) { service.stop(); service.awaitTerminated(); } } }