Code review comment: should we remove the doFinally logic from the tests?

Code before review:
public void executeBulk_cancel() throws InterruptedException {
int totalRequest = 100;
this.container = createContainer(database);
List<com.azure.cosmos.models.CosmosItemOperation> cosmosItemOperations = new ArrayList<>();
for (int i = 0; i < totalRequest; i++) {
String partitionKey = UUID.randomUUID().toString();
BatchTestBase.TestDoc testDoc = this.populateTestDoc(partitionKey);
cosmosItemOperations.add(CosmosBulkOperations.getCreateItemOperation(testDoc,
new PartitionKey(partitionKey)));
partitionKey = UUID.randomUUID().toString();
BatchTestBase.EventDoc eventDoc = new BatchTestBase.EventDoc(UUID.randomUUID().toString(), 2, 4, "type1",
partitionKey);
cosmosItemOperations.add(CosmosBulkOperations.getCreateItemOperation(eventDoc,
new PartitionKey(partitionKey)));
}
com.azure.cosmos.models.CosmosItemOperation[] itemOperationsArray =
new com.azure.cosmos.models.CosmosItemOperation[cosmosItemOperations.size()];
cosmosItemOperations.toArray(itemOperationsArray);
CosmosBulkExecutionOptions cosmosBulkExecutionOptions = new CosmosBulkExecutionOptions();
Flux<CosmosItemOperation> inputFlux = Flux
.fromArray(itemOperationsArray)
.delayElements(Duration.ofMillis(100));
final BulkExecutor<BulkExecutorTest> executor = new BulkExecutor<>(
container,
inputFlux,
cosmosBulkExecutionOptions);
Flux<com.azure.cosmos.models.CosmosBulkOperationResponse<BulkExecutorTest>> bulkResponseFlux =
Flux.deferContextual(context -> executor
.execute()
.doFinally((SignalType signal) -> {
if (signal == SignalType.ON_COMPLETE) {
logger.info("BulkExecutor.execute flux completed -
executor.getItemsLeftSnapshot(),
executor.getOperationContext());
} else {
int itemsLeftSnapshot = executor.getItemsLeftSnapshot();
if (itemsLeftSnapshot > 0) {
logger.info("BulkExecutor.execute flux terminated - Signal: {} -
+ "Context: {}",
signal,
itemsLeftSnapshot,
executor.getOperationContext());
} else {
logger.info("BulkExecutor.execute flux terminated - Signal: {} -
+ "Context: {}",
signal,
itemsLeftSnapshot,
executor.getOperationContext());
}
}
executor.dispose();
}));
Disposable disposable = bulkResponseFlux.subscribe();
disposable.dispose();
int iterations = 0;
while (true) {
assertThat(iterations < 100);
if (executor.isDisposed()) {
break;
}
Thread.sleep(10);
iterations++;
}
}

Line under review: .doFinally((SignalType signal) -> {

Code after addressing the review:
public void executeBulk_cancel() throws InterruptedException {
int totalRequest = 100;
this.container = createContainer(database);
List<CosmosItemOperation> cosmosItemOperations = new ArrayList<>();
for (int i = 0; i < totalRequest; i++) {
String partitionKey = UUID.randomUUID().toString();
BatchTestBase.TestDoc testDoc = this.populateTestDoc(partitionKey);
cosmosItemOperations.add(CosmosBulkOperations.getCreateItemOperation(testDoc,
new PartitionKey(partitionKey)));
partitionKey = UUID.randomUUID().toString();
BatchTestBase.EventDoc eventDoc = new BatchTestBase.EventDoc(UUID.randomUUID().toString(), 2, 4, "type1",
partitionKey);
cosmosItemOperations.add(CosmosBulkOperations.getCreateItemOperation(eventDoc,
new PartitionKey(partitionKey)));
}
CosmosItemOperation[] itemOperationsArray =
new CosmosItemOperation[cosmosItemOperations.size()];
cosmosItemOperations.toArray(itemOperationsArray);
CosmosBulkExecutionOptions cosmosBulkExecutionOptions = new CosmosBulkExecutionOptions();
Flux<CosmosItemOperation> inputFlux = Flux
.fromArray(itemOperationsArray)
.delayElements(Duration.ofMillis(100));
final BulkExecutor<BulkExecutorTest> executor = new BulkExecutor<>(
container,
inputFlux,
cosmosBulkExecutionOptions);
Flux<com.azure.cosmos.models.CosmosBulkOperationResponse<BulkExecutorTest>> bulkResponseFlux =
Flux.deferContextual(context -> executor.execute());
Disposable disposable = bulkResponseFlux.subscribe();
disposable.dispose();
int iterations = 0;
while (true) {
assertThat(iterations < 100);
if (executor.isDisposed()) {
break;
}
Thread.sleep(10);
iterations++;
}
}