Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

import static com.azure.core.util.FluxUtil.monoError;
Expand Down Expand Up @@ -117,6 +118,10 @@ public Mono<Response<AreaCodes>> getAllAreaCodesWithResponse(
Mono<Response<AreaCodes>> getAllAreaCodesWithResponse(
String locationType, String countryCode, String phonePlanId, List<LocationOptionsQuery> locationOptions,
Context context) {
Objects.requireNonNull(locationType, "'locationType' cannot be null.");
Objects.requireNonNull(countryCode, "'countryCode' cannot be null.");
Objects.requireNonNull(phonePlanId, "'phonePlanId' cannot be null.");

LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries();
locationOptionsQueries.setLocationOptions(locationOptions);

Expand Down Expand Up @@ -160,6 +165,8 @@ public Mono<Response<UpdatePhoneNumberCapabilitiesResponse>> getCapabilitiesUpda

Mono<Response<UpdatePhoneNumberCapabilitiesResponse>> getCapabilitiesUpdateWithResponse(
String capabilitiesId, Context context) {
Objects.requireNonNull(capabilitiesId, "'capabilitiesId' cannot be null.");

try {
if (context == null) {
return phoneNumberAdministrations.getCapabilitiesUpdateWithResponseAsync(capabilitiesId);
Expand Down Expand Up @@ -199,6 +206,8 @@ public Mono<Response<UpdateNumberCapabilitiesResponse>> updateCapabilitiesWithRe

Mono<Response<UpdateNumberCapabilitiesResponse>> updateCapabilitiesWithResponse(
Map<PhoneNumber, NumberUpdateCapabilities> phoneNumberCapabilitiesUpdate, Context context) {
Objects.requireNonNull(phoneNumberCapabilitiesUpdate, "'phoneNumberCapabilitiesUpdate' cannot be null.");

Map<String, NumberUpdateCapabilities> capabilitiesMap = new HashMap<>();
for (Map.Entry<PhoneNumber, NumberUpdateCapabilities> entry : phoneNumberCapabilitiesUpdate.entrySet()) {
capabilitiesMap.put(entry.getKey().getValue(), entry.getValue());
Expand Down Expand Up @@ -268,6 +277,8 @@ public Mono<Response<NumberConfigurationResponse>> getNumberConfigurationWithRes

Mono<Response<NumberConfigurationResponse>> getNumberConfigurationWithResponse(
PhoneNumber phoneNumber, Context context) {
Objects.requireNonNull(phoneNumber, "'phoneNumber' cannot be null.");

NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber();
configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue());

Expand Down Expand Up @@ -311,6 +322,9 @@ public Mono<Response<Void>> configureNumberWithResponse(

Mono<Response<Void>> configureNumberWithResponse(
PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration, Context context) {
Objects.requireNonNull(phoneNumber, "'phoneNumber' cannot be null.");
Objects.requireNonNull(pstnConfiguration, "'pstnConfiguration' cannot be null.");

NumberConfiguration numberConfiguration = new NumberConfiguration();
numberConfiguration.setPhoneNumber(phoneNumber.getValue()).setPstnConfiguration(pstnConfiguration);

Expand Down Expand Up @@ -348,6 +362,7 @@ public Mono<Response<Void>> unconfigureNumberWithResponse(PhoneNumber phoneNumbe
}

Mono<Response<Void>> unconfigureNumberWithResponse(PhoneNumber phoneNumber, Context context) {
Objects.requireNonNull(phoneNumber, "'phoneNumber' cannot be null.");
NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber();
configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue());

Expand Down Expand Up @@ -378,6 +393,8 @@ public PagedFlux<PhonePlanGroup> listPhonePlanGroups(

PagedFlux<PhonePlanGroup> listPhonePlanGroups(
String countryCode, String locale, Boolean includeRateInformation, Context context) {
Objects.requireNonNull(countryCode, "'countryCode' cannot be null.");

try {
if (context == null) {
return phoneNumberAdministrations.getPhonePlanGroupsAsync(
Expand Down Expand Up @@ -405,6 +422,9 @@ public PagedFlux<PhonePlan> listPhonePlans(String countryCode, String phonePlanG
}

PagedFlux<PhonePlan> listPhonePlans(String countryCode, String phonePlanGroupId, String locale, Context context) {
Objects.requireNonNull(countryCode, "'countryCode' cannot be null.");
Objects.requireNonNull(phonePlanGroupId, "'phonePlanGroupId' cannot be null.");

try {
if (context == null) {
return phoneNumberAdministrations.getPhonePlansAsync(
Expand Down Expand Up @@ -453,6 +473,10 @@ public Mono<Response<LocationOptionsResponse>> getPhonePlanLocationOptionsWithRe

Mono<Response<LocationOptionsResponse>> getPhonePlanLocationOptionsWithResponse(
String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context) {
Objects.requireNonNull(countryCode, "'countryCode' cannot be null.");
Objects.requireNonNull(phonePlanGroupId, "'phonePlanGroupId' cannot be null.");
Objects.requireNonNull(phonePlanId, "'phonePlanId' cannot be null.");

try {
if (context == null) {
return phoneNumberAdministrations.getPhonePlanLocationOptionsWithResponseAsync(
Expand Down Expand Up @@ -490,6 +514,8 @@ public Mono<Response<PhoneNumberRelease>> getReleaseByIdWithResponse(String rele
}

Mono<Response<PhoneNumberRelease>> getReleaseByIdWithResponse(String releaseId, Context context) {
Objects.requireNonNull(releaseId, "'releaseId' cannot be null.");

try {
if (context == null) {
return phoneNumberAdministrations.getReleaseByIdWithResponseAsync(releaseId);
Expand Down Expand Up @@ -525,6 +551,8 @@ public Mono<Response<ReleaseResponse>> releasePhoneNumbersWithResponse(List<Phon
}

Mono<Response<ReleaseResponse>> releasePhoneNumbersWithResponse(List<PhoneNumber> phoneNumbers, Context context) {
Objects.requireNonNull(phoneNumbers, "'phoneNumbers' cannot be null.");

List<String> phoneNumberStrings = phoneNumbers.stream().map(PhoneNumber::getValue).collect(Collectors.toList());
ReleaseRequest releaseRequest = new ReleaseRequest();
releaseRequest.setPhoneNumbers(phoneNumberStrings);
Expand Down Expand Up @@ -586,6 +614,8 @@ public Mono<Response<PhoneNumberSearch>> getSearchByIdWithResponse(String search
}

Mono<Response<PhoneNumberSearch>> getSearchByIdWithResponse(String searchId, Context context) {
Objects.requireNonNull(searchId, "'searchId' cannot be null.");

try {
if (context == null) {
return phoneNumberAdministrations.getSearchByIdWithResponseAsync(searchId);
Expand Down Expand Up @@ -621,6 +651,8 @@ public Mono<Response<CreateSearchResponse>> createSearchWithResponse(CreateSearc
}

Mono<Response<CreateSearchResponse>> createSearchWithResponse(CreateSearchOptions searchOptions, Context context) {
Objects.requireNonNull(searchOptions, "'searchOptions' cannot be null.");

try {
if (context == null) {
return phoneNumberAdministrations.createSearchWithResponseAsync(searchOptions);
Expand Down Expand Up @@ -677,6 +709,8 @@ public Mono<Response<Void>> cancelSearchWithResponse(String searchId) {
}

Mono<Response<Void>> cancelSearchWithResponse(String searchId, Context context) {
Objects.requireNonNull(searchId, "'searchId' cannot be null.");

try {
if (context == null) {
return phoneNumberAdministrations.cancelSearchWithResponseAsync(searchId);
Expand Down Expand Up @@ -711,6 +745,8 @@ public Mono<Response<Void>> purchaseSearchWithResponse(String searchId) {
}

Mono<Response<Void>> purchaseSearchWithResponse(String searchId, Context context) {
Objects.requireNonNull(searchId, "'searchId' cannot be null.");

try {
if (context == null) {
return phoneNumberAdministrations.purchaseSearchWithResponseAsync(searchId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public PhoneNumberClientBuilder endpoint(String endpoint) {
* @return The updated {@link PhoneNumberClientBuilder} object.
*/
public PhoneNumberClientBuilder pipeline(HttpPipeline pipeline) {
this.pipeline = Objects.requireNonNull(pipeline, "'pipeline' cannot be null.");
this.pipeline = pipeline;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,6 @@ public void setEndpointNull() {
});
}

@Test()
public void setPipelineNull() {
assertThrows(NullPointerException.class, () -> {
this.clientBuilder.pipeline(null);
});
}

@Test()
public void setHttpClientNull() {
assertThrows(NullPointerException.class, () -> {
Expand Down