@Test @SuppressWarnings("resource") public void _250Hz_correctly_sets_4ms_job_interval() throws Exception { new Sender(onrampClient, contextManager, 250, service).start(); verify(service).scheduleAtFixedRate(any(), eq(0L), longCaptor.capture(), timeunitCaptor.capture()); assertThat(timeunitCaptor.getValue().toMillis(longCaptor.getValue()), is(4L)); }
public void start() { log.info("Starting message sender at {}Hz", messageRate); service.scheduleAtFixedRate(this::worker, 0, 1000 / messageRate, MILLISECONDS); }
Sender implements AutoCloseable { public void start() { log.info("Starting message sender at {}Hz", messageRate); service.scheduleAtFixedRate(this::worker, 0, 1000 / messageRate, MILLISECONDS); } }
Sender implements AutoCloseable { public void start() { log.info("Starting message sender at {}Hz", messageRate); service.scheduleAtFixedRate(this::worker, 0, 1000 / messageRate, MILLISECONDS); } @Autowired  Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      @Value("${messageHz}") long messageRate);   Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      long messageRate,
      ScheduledExecutorService service); }
Sender implements AutoCloseable { public void start() { log.info("Starting message sender at {}Hz", messageRate); service.scheduleAtFixedRate(this::worker, 0, 1000 / messageRate, MILLISECONDS); } @Autowired  Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      @Value("${messageHz}") long messageRate);   Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      long messageRate,
      ScheduledExecutorService service); void start(); void worker(); @Override void close(); }
Sender implements AutoCloseable { public void start() { log.info("Starting message sender at {}Hz", messageRate); service.scheduleAtFixedRate(this::worker, 0, 1000 / messageRate, MILLISECONDS); } @Autowired  Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      @Value("${messageHz}") long messageRate);   Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      long messageRate,
      ScheduledExecutorService service); void start(); void worker(); @Override void close();  }