}
private void runBatch(final int expectCount, final int batchHint,
final TraversalDelayPolicy expectDelayPolicy) throws Exception {
BatchSize batchSize = new BatchSize(batchHint);
BatchResult expectResult = new BatchResult(expectDelayPolicy, expectCount);
MockTraverser traverser = new MockTraverser(batchSize, expectResult);
MockBatchResultRecorder recorder = new MockBatchResultRecorder();
MockBatchTimeout batchTimeout = new MockBatchTimeout();
CancelableBatch batch =
new CancelableBatch(traverser, "connector1", recorder, batchTimeout,
batchSize);
batch.run();
BatchResult batchResult = recorder.getBatchResult();
assertEquals(expectResult, batchResult);
// TODO(strellis): Validate retryDelayMillis or remove it from
// BatchRecorder.
// TODO(bjohnson): Create tests where batchHint != batchMaximum, esp.
// where returned batch has batchMaximum and greater than batchMaximum.