Code review comment: Yes it does. If we see flakiness later we can add some idle time.

Code before review:
public void validQuerySucceeds(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) {
DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion);
String floorModelId = UniqueIdHelper.getUniqueModelId(TestAssetDefaults.FLOOR_MODEL_ID_PREFIX, asyncClient, randomIntegerStringGenerator);
String roomModelId = UniqueIdHelper.getUniqueModelId(TestAssetDefaults.ROOM_MODEL_ID_PREFIX, asyncClient, randomIntegerStringGenerator);
String roomTwinId = UniqueIdHelper.getUniqueDigitalTwinId(TestAssetDefaults.ROOM_TWIN_ID_PREFIX, asyncClient, randomIntegerStringGenerator);
try {
String roomModelPayload = TestAssetsHelper.getRoomModelPayload(roomModelId, floorModelId);
StepVerifier.create(asyncClient.createModels(new ArrayList<>(Arrays.asList(roomModelPayload))))
.assertNext(response ->
assertThat(response.size())
.as("Created models successfully")
.isEqualTo(1))
.verifyComplete();
String roomTwin = TestAssetsHelper.getRoomTwinPayload(roomModelId);
StepVerifier.create(asyncClient.createDigitalTwinWithResponse(roomTwinId, roomTwin))
.assertNext(response ->
assertThat(response.getStatusCode())
.as("Created digitaltwin successfully")
.isEqualTo(HttpURLConnection.HTTP_OK))
.verifyComplete();
String queryString = "SELECT * FROM digitaltwins where IsOccupied = true";
StepVerifier.create(asyncClient.query(queryString, BasicDigitalTwin.class))
.thenConsumeWhile(dt ->  {
assertThat(dt.getCustomProperties().get("IsOccupied"))
.as("IsOccupied should be true")
.isEqualTo(true);
return true;
})
.verifyComplete();
}
finally {
try {
if (roomTwinId != null) {
asyncClient.deleteDigitalTwin(roomTwinId).block();
}
if (roomModelId != null){
asyncClient.deleteModel(roomModelId).block();
}
}
catch (Exception ex)
{
fail("Failed to cleanup due to: ", ex);
}
}
}

Line under review: StepVerifier.create(asyncClient.query(queryString, BasicDigitalTwin.class))

Code after addressing the review:
public void validQuerySucceeds(HttpClient httpClient, DigitalTwinsServiceVersion serviceVersion) {
DigitalTwinsAsyncClient asyncClient = getAsyncClient(httpClient, serviceVersion);
String floorModelId = UniqueIdHelper.getUniqueModelId(TestAssetDefaults.FLOOR_MODEL_ID_PREFIX, asyncClient, randomIntegerStringGenerator);
String roomModelId = UniqueIdHelper.getUniqueModelId(TestAssetDefaults.ROOM_MODEL_ID_PREFIX, asyncClient, randomIntegerStringGenerator);
String roomTwinId = UniqueIdHelper.getUniqueDigitalTwinId(TestAssetDefaults.ROOM_TWIN_ID_PREFIX, asyncClient, randomIntegerStringGenerator);
try {
String roomModelPayload = TestAssetsHelper.getRoomModelPayload(roomModelId, floorModelId);
StepVerifier.create(asyncClient.createModels(new ArrayList<>(Arrays.asList(roomModelPayload))))
.assertNext(response ->
assertThat(response.size())
.as("Created models successfully")
.isEqualTo(1))
.verifyComplete();
String roomTwin = TestAssetsHelper.getRoomTwinPayload(roomModelId);
StepVerifier.create(asyncClient.createDigitalTwinWithResponse(roomTwinId, roomTwin))
.assertNext(response ->
assertThat(response.getStatusCode())
.as("Created digitaltwin successfully")
.isEqualTo(HttpURLConnection.HTTP_OK))
.verifyComplete();
String queryString = "SELECT * FROM digitaltwins where IsOccupied = true";
StepVerifier.create(asyncClient.query(queryString, BasicDigitalTwin.class))
.thenConsumeWhile(dt ->  {
assertThat(dt.getCustomProperties().get("IsOccupied"))
.as("IsOccupied should be true")
.isEqualTo(true);
return true;
})
.verifyComplete();
}
finally {
try {
if (roomTwinId != null) {
asyncClient.deleteDigitalTwin(roomTwinId).block();
}
if (roomModelId != null){
asyncClient.deleteModel(roomModelId).block();
}
}
catch (Exception ex)
{
fail("Failed to cleanup due to: ", ex);
}
}
}