synchronized Optional<ExecutableWork> completeWorkAndGetNextWorkForKey(
      ShardedKey shardedKey, WorkId workId) {
    @Nullable Queue<ExecutableWork> workQueue = activeWork.get(shardedKey);
    if (workQueue == null) {
      // Work may have been completed due to clearing of stuck commits.
      LOG.warn("Unable to complete inactive work for key {} and token {}.", shardedKey, workId);
      return Optional.empty();
    }
    removeCompletedWorkFromQueue(workQueue, shardedKey, workId);
    return getNextWork(workQueue, shardedKey);
  }
@Test
  public void testCompleteWorkAndGetNextWorkForKey_noWorkQueueForKey() {
    assertEquals(
        Optional.empty(),
        activeWorkState.completeWorkAndGetNextWorkForKey(
            shardedKey("someKey", 1L), workId(1L, 1L)));
  }