Long nextUniqueId() {
    try {
      Thread.sleep(ThreadLocalRandom.current().nextInt(RANDOM_JITTER_DELAY));
      return executor
          .submit(stepInstanceDao::getNextUniqueId)
          .get(TIMEOUT_IN_MILLIS, TimeUnit.MILLISECONDS);
    } catch (Exception e) {
      throw new MaestroInternalError(e, "nextUniqueId throws an exception");
    }
  }
@Test
  public void testNextUniqueId() {
    Long expected = 750762533885116445L;
    when(stepInstanceDao.getNextUniqueId()).thenReturn(expected);
    assertEquals(expected, paramExtension.nextUniqueId());

    when(stepInstanceDao.getNextUniqueId())
        .thenThrow(new MaestroNotFoundException("test exception"));
    AssertHelper.assertThrows(
        "cannot get next unique id",
        MaestroInternalError.class,
        "nextUniqueId throws an exception",
        () -> paramExtension.nextUniqueId());
  }