Java Code Examples for io.grpc.Status#INVALID_ARGUMENT

The following examples show how to use io.grpc.Status#INVALID_ARGUMENT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CampaignBidModifierServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateCampaignBidModifiersExceptionTest2() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockCampaignBidModifierService.addException(exception);

  try {
    String customerId = "customerId-1772061412";
    List<CampaignBidModifierOperation> operations = new ArrayList<>();

    client.mutateCampaignBidModifiers(customerId, operations);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 2
Source File: AdGroupCriterionLabelServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateAdGroupCriterionLabelsExceptionTest2() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockAdGroupCriterionLabelService.addException(exception);

  try {
    String customerId = "customerId-1772061412";
    List<AdGroupCriterionLabelOperation> operations = new ArrayList<>();

    client.mutateAdGroupCriterionLabels(customerId, operations);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 3
Source File: CampaignLabelServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void getCampaignLabelExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockCampaignLabelService.addException(exception);

  try {
    String formattedResourceName =
        CampaignLabelServiceClient.formatCampaignLabelName("[CUSTOMER]", "[CAMPAIGN_LABEL]");

    client.getCampaignLabel(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 4
Source File: RecommendationServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void dismissRecommendationExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockRecommendationService.addException(exception);

  try {
    String customerId = "customerId-1772061412";
    List<DismissRecommendationRequest.DismissRecommendationOperation> operations =
        new ArrayList<>();
    boolean partialFailure = true;

    client.dismissRecommendation(customerId, operations, partialFailure);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 5
Source File: CampaignLabelServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void getCampaignLabelExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockCampaignLabelService.addException(exception);

  try {
    String formattedResourceName =
        CampaignLabelServiceClient.formatCampaignLabelName("[CUSTOMER]", "[CAMPAIGN_LABEL]");

    client.getCampaignLabel(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 6
Source File: KeywordPlanNegativeKeywordServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateKeywordPlanNegativeKeywordsExceptionTest2() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockKeywordPlanNegativeKeywordService.addException(exception);

  try {
    String customerId = "customerId-1772061412";
    List<KeywordPlanNegativeKeywordOperation> operations = new ArrayList<>();

    client.mutateKeywordPlanNegativeKeywords(customerId, operations);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 7
Source File: KeywordPlanServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void generateForecastMetricsExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockKeywordPlanService.addException(exception);

  try {
    String formattedKeywordPlan =
        KeywordPlanServiceClient.formatKeywordPlanName("[CUSTOMER]", "[KEYWORD_PLAN]");

    client.generateForecastMetrics(formattedKeywordPlan);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 8
Source File: CustomerFeedServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateCustomerFeedsExceptionTest2() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockCustomerFeedService.addException(exception);

  try {
    String customerId = "customerId-1772061412";
    List<CustomerFeedOperation> operations = new ArrayList<>();

    client.mutateCustomerFeeds(customerId, operations);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 9
Source File: AdGroupCriterionLabelServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void getAdGroupCriterionLabelExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockAdGroupCriterionLabelService.addException(exception);

  try {
    String formattedResourceName =
        AdGroupCriterionLabelServiceClient.formatAdGroupCriterionLabelName(
            "[CUSTOMER]", "[AD_GROUP_CRITERION_LABEL]");

    client.getAdGroupCriterionLabel(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 10
Source File: FeedMappingServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateFeedMappingsExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockFeedMappingService.addException(exception);

  try {
    String customerId = "customerId-1772061412";
    List<FeedMappingOperation> operations = new ArrayList<>();
    boolean partialFailure = true;
    boolean validateOnly = false;

    client.mutateFeedMappings(customerId, operations, partialFailure, validateOnly);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 11
Source File: TopicViewServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void getTopicViewExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockTopicViewService.addException(exception);

  try {
    String formattedResourceName =
        TopicViewServiceClient.formatTopicViewName("[CUSTOMER]", "[TOPIC_VIEW]");

    client.getTopicView(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 12
Source File: AgeRangeViewServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void getAgeRangeViewExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockAgeRangeViewService.addException(exception);

  try {
    String formattedResourceName =
        AgeRangeViewServiceClient.formatAgeRangeViewName("[CUSTOMER]", "[AGE_RANGE_VIEW]");

    client.getAgeRangeView(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 13
Source File: ManagedPlacementViewServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void getManagedPlacementViewExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockManagedPlacementViewService.addException(exception);

  try {
    String formattedResourceName =
        ManagedPlacementViewServiceClient.formatManagedPlacementViewName(
            "[CUSTOMER]", "[MANAGED_PLACEMENT_VIEW]");

    client.getManagedPlacementView(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 14
Source File: CampaignExperimentServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateCampaignExperimentsExceptionTest2() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockCampaignExperimentService.addException(exception);

  try {
    String customerId = "customerId-1772061412";
    List<CampaignExperimentOperation> operations = new ArrayList<>();

    client.mutateCampaignExperiments(customerId, operations);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 15
Source File: CampaignLabelServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateCampaignLabelsExceptionTest2() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockCampaignLabelService.addException(exception);

  try {
    String customerId = "customerId-1772061412";
    List<CampaignLabelOperation> operations = new ArrayList<>();

    client.mutateCampaignLabels(customerId, operations);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 16
Source File: RemarketingActionServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateRemarketingActionsExceptionTest2() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockRemarketingActionService.addException(exception);

  try {
    String customerId = "customerId-1772061412";
    List<RemarketingActionOperation> operations = new ArrayList<>();

    client.mutateRemarketingActions(customerId, operations);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 17
Source File: MerchantCenterLinkServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void getMerchantCenterLinkExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockMerchantCenterLinkService.addException(exception);

  try {
    String formattedResourceName =
        MerchantCenterLinkServiceClient.formatMerchantCenterLinkName(
            "[CUSTOMER]", "[MERCHANT_CENTER_LINK]");

    client.getMerchantCenterLink(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 18
Source File: InternalPhotosLibraryClientTest.java    From java-photoslibrary with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void batchRemoveMediaItemsFromAlbumExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockPhotosLibrary.addException(exception);

  try {
    String albumId = "albumId1532078315";
    List<String> mediaItemIds = new ArrayList<>();

    client.batchRemoveMediaItemsFromAlbum(albumId, mediaItemIds);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 19
Source File: CustomerExtensionSettingServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateCustomerExtensionSettingsExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockCustomerExtensionSettingService.addException(exception);

  try {
    String customerId = "customerId-1772061412";
    List<CustomerExtensionSettingOperation> operations = new ArrayList<>();
    boolean partialFailure = true;
    boolean validateOnly = false;

    client.mutateCustomerExtensionSettings(customerId, operations, partialFailure, validateOnly);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example 20
Source File: InternalPhotosLibraryClientTest.java    From java-photoslibrary with Apache License 2.0 5 votes vote down vote up
@Test
@SuppressWarnings("all")
public void joinSharedAlbumExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockPhotosLibrary.addException(exception);

  try {
    String shareToken = "shareToken407816601";

    client.joinSharedAlbum(shareToken);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}