WorkItemStatusClient { public synchronized void setWorker( DataflowWorkExecutor worker, BatchModeExecutionContext executionContext) { checkArgument(worker != null, "worker must be non-null"); checkState(this.worker == null, "Can only call setWorker once"); this.worker = worker; this.executionContext = executionContext; } WorkItemStatusClient(WorkUnitClient workUnitClient, WorkItem workItem); String uniqueWorkId(); synchronized void setWorker(
      DataflowWorkExecutor worker, BatchModeExecutionContext executionContext); synchronized WorkItemServiceState reportError(Throwable e); synchronized WorkItemServiceState reportSuccess(); synchronized WorkItemServiceState reportUpdate(
      @Nullable DynamicSplitResult dynamicSplitResult, Duration requestedLeaseDuration); Iterable<CounterUpdate> extractMsecCounters(boolean isFinalUpdate); long extractThrottleTime();  }
@Test public void setWorker() { statusClient.setWorker(worker, executionContext); thrown.expect(IllegalStateException.class); thrown.expectMessage("setWorker once"); statusClient.setWorker(worker, executionContext); }