io.grpc.Status#INVALID_ARGUMENT源码实例Demo

下面列出了io.grpc.Status#INVALID_ARGUMENT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}
 
@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
  }
}