@Override
  public void commit(Commit commit) {
    commitQueue.put(commit);
  }
@Test
  public void testCommit() {
    List<CompleteCommit> completeCommits = new ArrayList<>();
    workCommitter = createWorkCommitter(completeCommits::add);
    List<Commit> commits = new ArrayList<>();
    for (int i = 1; i <= 5; i++) {
      Work work = createMockWork(i);
      Windmill.WorkItemCommitRequest commitRequest =
          Windmill.WorkItemCommitRequest.newBuilder()
              .setKey(work.getWorkItem().getKey())
              .setShardingKey(work.getWorkItem().getShardingKey())
              .setWorkToken(work.getWorkItem().getWorkToken())
              .setCacheToken(work.getWorkItem().getCacheToken())
              .build();
      commits.add(Commit.create(commitRequest, createComputationState("computationId-" + i), work));
    }

    workCommitter.start();
    commits.forEach(workCommitter::commit);

    Map<Long, Windmill.WorkItemCommitRequest> committed =
        fakeWindmillServer.waitForAndGetCommits(commits.size());

    for (Commit commit : commits) {
      Windmill.WorkItemCommitRequest request =
          committed.get(commit.work().getWorkItem().getWorkToken());
      assertNotNull(request);
      assertThat(request).isEqualTo(commit.request());
    }

    assertThat(completeCommits).hasSize(commits.size());
    assertThat(completeCommits)
        .comparingElementsUsing(
            Correspondence.from(
                (CompleteCommit completeCommit, Commit commit) ->
                    completeCommit.computationId().equals(commit.computationId())
                        && completeCommit.status() == Windmill.CommitStatus.OK
                        && completeCommit.workId().equals(commit.work().id())
                        && completeCommit
                            .shardedKey()
                            .equals(
                                ShardedKey.create(
                                    commit.request().getKey(), commit.request().getShardingKey())),
                "expected to equal"))
        .containsExactlyElementsIn(commits);
  }