diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java index a8e2677581968..979507befa82e 100644 --- a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java @@ -805,12 +805,11 @@ public PollerFlux beginCreateSearch( getSearchById(pollingContext.getLatestResponse().getValue().getSearchId()) .flatMap(getSearchResponse -> { SearchStatus status = getSearchResponse.getStatus(); - if (status.equals(SearchStatus.SUCCESS) - || status.equals(SearchStatus.EXPIRED) + if (status.equals(SearchStatus.EXPIRED) || status.equals(SearchStatus.CANCELLED) || status.equals(SearchStatus.RESERVED)) { - return Mono.just(new PollResponse<>( - LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getSearchResponse)); + return Mono.just(new PollResponse<>( + LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getSearchResponse)); } if (status.equals(SearchStatus.ERROR)) { return Mono.just(new PollResponse<>( diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java index 1bbeee7199585..807c347e38cb6 100644 --- a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java @@ -23,7 +23,6 @@ import com.azure.communication.common.PhoneNumber; import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.Response; -import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.core.util.Context; import org.junit.jupiter.api.Test;