private void verifyPrepareWorkerExecutionAndMonitor(JobModel jobModel, MetadataResourceUtil metadataResourceUtil,
      StreamPartitionCountMonitor streamPartitionCountMonitor, StreamRegexMonitor streamRegexMonitor,
      JobCoordinatorMetadata newMetadata, Map<TaskName, Set<SystemStreamPartition>> expectedFanOut) throws IOException {
    InOrder inOrder = inOrder(this.jobCoordinatorMetadataManager, this.jobModelServingContext, metadataResourceUtil,
        this.startpointManager, this.coordinatorCommunication);
    if (newMetadata != null) {
      inOrder.verify(this.jobCoordinatorMetadataManager).writeJobCoordinatorMetadata(newMetadata);
    } else {
      verify(this.jobCoordinatorMetadataManager, never()).writeJobCoordinatorMetadata(any());
    }
    inOrder.verify(this.jobModelServingContext).setJobModel(jobModel);
    inOrder.verify(metadataResourceUtil).createResources();
    if (expectedFanOut != null) {
      inOrder.verify(this.startpointManager).fanOut(expectedFanOut);
    } else {
      verify(this.startpointManager, never()).fanOut(any());
    }
    inOrder.verify(this.coordinatorCommunication).start();
    verify(streamPartitionCountMonitor).start();
    if (streamRegexMonitor != null) {
      verify(streamRegexMonitor).start();
    }
  }
Common steps to verify when preparing workers for processing.
@param jobModel job model to be served for workers
@param metadataResourceUtil expected to be used for creating resources
@param streamPartitionCountMonitor expected to be started
@param streamRegexMonitor if not null, expected to be started
@param newMetadata if not null, expected to be written to {@link JobCoordinatorMetadataManager}
@param expectedFanOut if not null, expected to be passed to {@link StartpointManager} for fan out
samza-core/src/test/java/org/apache/samza/coordinator/staticresource/TestStaticResourceJobCoordinator.java