diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index d830ea151eda..25318966f0e0 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -258,10 +258,7 @@ public void getTollFreeAreaCodesWithAAD(HttpClient httpClient) { StepVerifier.create( this.getClientWithManagedIdentity(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US", PhoneNumberAssignmentType.APPLICATION).next()) - .assertNext((PhoneNumberAreaCode areaCodes) -> { - assertNotNull(areaCodes.getAreaCode()); - }) - .verifyComplete(); + .expectAccessibleContext(); } @ParameterizedTest @@ -336,10 +333,7 @@ public void getTollFreeAreaCodes(HttpClient httpClient) { StepVerifier.create( this.getClientWithConnectionString(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US", PhoneNumberAssignmentType.APPLICATION).next()) - .assertNext((PhoneNumberAreaCode areaCodes) -> { - assertNotNull(areaCodes.getAreaCode()); - }) - .verifyComplete(); + .expectAccessibleContext(); } @ParameterizedTest diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java index de10eadd480b..f1b465e8d8f5 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java @@ -30,9 +30,12 @@ import org.junit.jupiter.params.provider.MethodSource; import java.time.Duration; +import java.util.Arrays; +import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; public class PhoneNumbersClientIntegrationTest extends PhoneNumbersIntegrationTestBase { @@ -181,8 +184,11 @@ public void getTollFreeAreaCodes(HttpClient httpClient) { PagedIterable areaCodesResult = this .getClientWithConnectionString(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US"); - PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); - assertNotNull(areaCodes); + List expectedAreaCodes = Arrays.asList("888", "877", "866", "855", "844", "800", "833", "88"); + for (PhoneNumberAreaCode areaCode : areaCodesResult) { + assertTrue(expectedAreaCodes.contains(areaCode.getAreaCode())); + } + assertNotNull(areaCodesResult); } @ParameterizedTest @@ -246,8 +252,11 @@ public void getTollFreeAreaCodesWithAAD(HttpClient httpClient) { PagedIterable areaCodesResult = this .getClientWithManagedIdentity(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US"); - PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); - assertNotNull(areaCodes); + List expectedAreaCodes = Arrays.asList("888", "877", "866", "855", "844", "800", "833", "88"); + for (PhoneNumberAreaCode areaCode : areaCodesResult) { + assertTrue(expectedAreaCodes.contains(areaCode.getAreaCode())); + } + assertNotNull(areaCodesResult); } @ParameterizedTest