io.grpc.StatusRuntimeException Java Examples

The following examples show how to use io.grpc.StatusRuntimeException. 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: CustomerManagerLinkServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateCustomerManagerLinkExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockCustomerManagerLinkService.addException(exception);

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

    client.mutateCustomerManagerLink(customerId, operations);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example #2
Source File: HederaCall.java    From hedera-sdk-java with Apache License 2.0 6 votes vote down vote up
public Resp execute(Client client, Duration retryTimeout) throws HederaStatusException, HederaNetworkException, LocalValidationException {
    // Run local validator just before execute
    localValidate();

    // N.B. only QueryBuilder used onPreExecute() so instead it should just override this
    // method instead

    final Backoff.FallibleProducer<Resp, HederaStatusException> tryProduce = () -> {
        try {
            return mapResponse(ClientCalls.blockingUnaryCall(getChannel(client).newCall(getMethod(), CallOptions.DEFAULT), toProto()));
        } catch (StatusRuntimeException e) {
            throw new HederaNetworkException(e);
        }
    };

    return new Backoff(RETRY_DELAY, retryTimeout)
        .tryWhile(this::shouldRetry, tryProduce);
}
 
Example #3
Source File: KeywordPlanServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateKeywordPlansExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockKeywordPlanService.addException(exception);

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

    client.mutateKeywordPlans(customerId, operations, partialFailure, validateOnly);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example #4
Source File: RqdClientGrpc.java    From OpenCue with Apache License 2.0 6 votes vote down vote up
public void killFrame(String host, String frameId, String message) {
    RqdStaticKillRunningFrameRequest request =
            RqdStaticKillRunningFrameRequest.newBuilder()
            .setFrameId(frameId)
            .setMessage(message)
            .build();

    if (testMode) {
        return;
    }

    try {
        logger.info("killing frame on " + host + ", source: " + message);
        getStub(host).killRunningFrame(request);
    } catch(StatusRuntimeException | ExecutionException e) {
        throw new RqdClientException("failed to kill frame " + frameId, e);
    }
}
 
Example #5
Source File: CascadingTest.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
/**
 * Test that when RPC cancellation propagates up a call chain, the cancellation of the parent
 * RPC triggers cancellation of all of its children.
 */
@Test
public void testCascadingCancellationViaLeafFailure() throws Exception {
  // All nodes (15) except one edge of the tree (4) will be cancelled.
  observedCancellations = new CountDownLatch(11);
  receivedCancellations = new CountDownLatch(11);
  startCallTreeServer(3);
  try {
    // Use response size limit to control tree nodeCount.
    blockingStub.unaryCall(Messages.SimpleRequest.newBuilder().setResponseSize(3).build());
    fail("Expected abort");
  } catch (StatusRuntimeException sre) {
    // Wait for the workers to finish
    Status status = sre.getStatus();
    // Outermost caller observes ABORTED propagating up from the failing leaf,
    // The descendant RPCs are cancelled so they receive CANCELLED.
    assertEquals(Status.Code.ABORTED, status.getCode());

    if (!observedCancellations.await(5, TimeUnit.SECONDS)) {
      fail("Expected number of cancellations not observed by clients");
    }
    if (!receivedCancellations.await(5, TimeUnit.SECONDS)) {
      fail("Expected number of cancellations to be received by servers not observed");
    }
  }
}
 
Example #6
Source File: BillingSetupServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateBillingSetupExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockBillingSetupService.addException(exception);

  try {
    String customerId = "customerId-1772061412";
    BillingSetupOperation operation = BillingSetupOperation.newBuilder().build();

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

  try {
    String formattedResourceName =
        DisplayKeywordViewServiceClient.formatDisplayKeywordViewName(
            "[CUSTOMER]", "[DISPLAY_KEYWORD_VIEW]");

    client.getDisplayKeywordView(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example #8
Source File: MessageDeframerTest.java    From grpc-nebula-java with Apache License 2.0 6 votes vote down vote up
@Test
public void sizeEnforcingInputStream_readByteAboveLimit() throws IOException {
  ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(Charsets.UTF_8));
  SizeEnforcingInputStream stream =
          new MessageDeframer.SizeEnforcingInputStream(in, 2, statsTraceCtx);

  try {
    thrown.expect(StatusRuntimeException.class);
    thrown.expectMessage("RESOURCE_EXHAUSTED: Compressed gRPC message exceeds");

    while (stream.read() != -1) {
    }
  } finally {
    stream.close();
  }
}
 
Example #9
Source File: CampaignDraftServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void listCampaignDraftAsyncErrorsExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockCampaignDraftService.addException(exception);

  try {
    String formattedResourceName =
        CampaignDraftServiceClient.formatCampaignDraftName("[CUSTOMER]", "[CAMPAIGN_DRAFT]");

    client.listCampaignDraftAsyncErrors(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example #10
Source File: AuthServiceUtils.java    From modeldb with Apache License 2.0 6 votes vote down vote up
private UserInfo getCurrentLoginUserInfo(boolean retry) {
  try (AuthServiceChannel authServiceChannel = new AuthServiceChannel()) {
    LOGGER.info(ModelDBMessages.AUTH_SERVICE_REQ_SENT_MSG);
    UserInfo userInfo =
        authServiceChannel.getUacServiceBlockingStub().getCurrentUser(Empty.newBuilder().build());
    LOGGER.info(ModelDBMessages.AUTH_SERVICE_RES_RECEIVED_MSG);

    if (userInfo == null || userInfo.getVertaInfo() == null) {
      LOGGER.info("user not found {}", userInfo);
      Status status =
          Status.newBuilder()
              .setCode(Code.NOT_FOUND_VALUE)
              .setMessage("Current user could not be resolved.")
              .build();
      throw StatusProto.toStatusRuntimeException(status);
    } else {
      return userInfo;
    }
  } catch (StatusRuntimeException ex) {
    return (UserInfo)
        ModelDBUtils.retryOrThrowException(
            ex, retry, (ModelDBUtils.RetryCallInterface<UserInfo>) this::getCurrentLoginUserInfo);
  }
}
 
Example #11
Source File: FeedItemServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateFeedItemsExceptionTest2() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockFeedItemService.addException(exception);

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

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

  try {
    String formattedResourceName =
        ClickViewServiceClient.formatClickViewName("[CUSTOMER]", "[CLICK_VIEW]");

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

  try {
    String formattedResourceName =
        GoogleAdsFieldServiceClient.formatGoogleAdsFieldName("[GOOGLE_ADS_FIELD]");

    client.getGoogleAdsField(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example #14
Source File: ChannelzService.java    From grpc-nebula-java with Apache License 2.0 6 votes vote down vote up
/** Returns a top level channel aka {@link io.grpc.ManagedChannel}. */
@Override
public void getChannel(
    GetChannelRequest request, StreamObserver<GetChannelResponse> responseObserver) {
  InternalInstrumented<ChannelStats> s = channelz.getRootChannel(request.getChannelId());
  if (s == null) {
    responseObserver.onError(
        Status.NOT_FOUND.withDescription("Can't find channel " + request.getChannelId())
            .asRuntimeException());
    return;
  }

  GetChannelResponse resp;
  try {
    resp = GetChannelResponse
        .newBuilder()
        .setChannel(ChannelzProtoUtil.toChannel(s))
        .build();
  } catch (StatusRuntimeException e) {
    responseObserver.onError(e);
    return;
  }

  responseObserver.onNext(resp);
  responseObserver.onCompleted();
}
 
Example #15
Source File: TransmitUnexpectedExceptionInterceptorTest.java    From grpc-java-contrib with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void alleMatches() {
    GreeterGrpc.GreeterImplBase svc = new GreeterGrpc.GreeterImplBase() {
        @Override
        public void sayHello(HelloRequest request, StreamObserver<HelloResponse> responseObserver) {
            responseObserver.onError(new ArithmeticException("Divide by zero"));
        }
    };

    ServerInterceptor interceptor = new TransmitUnexpectedExceptionInterceptor().forAllExceptions();

    serverRule.getServiceRegistry().addService(ServerInterceptors.intercept(svc, interceptor));
    GreeterGrpc.GreeterBlockingStub stub = GreeterGrpc.newBlockingStub(serverRule.getChannel());

    assertThatThrownBy(() -> stub.sayHello(HelloRequest.newBuilder().setName("World").build()))
            .isInstanceOf(StatusRuntimeException.class)
            .matches(sre -> ((StatusRuntimeException) sre).getStatus().getCode().equals(Status.INTERNAL.getCode()), "is Status.INTERNAL")
            .hasMessageContaining("Divide by zero");
}
 
Example #16
Source File: FeedItemTargetServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void getFeedItemTargetExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockFeedItemTargetService.addException(exception);

  try {
    String formattedResourceName =
        FeedItemTargetServiceClient.formatFeedItemTargetName("[CUSTOMER]", "[FEED_ITEM_TARGET]");

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

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

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

  try {
    String formattedResourceName =
        ExpandedLandingPageViewServiceClient.formatExpandedLandingPageViewName(
            "[CUSTOMER]", "[EXPANDED_LANDING_PAGE_VIEW]");

    client.getExpandedLandingPageView(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example #19
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 #20
Source File: RoleServiceUtils.java    From modeldb with Apache License 2.0 6 votes vote down vote up
private void setRoleBindingOnAuthService(boolean retry, RoleBinding roleBinding) {
  try (AuthServiceChannel authServiceChannel = new AuthServiceChannel()) {
    LOGGER.info(ModelDBMessages.CALL_TO_ROLE_SERVICE_MSG);
    SetRoleBinding.Response setRoleBindingResponse =
        authServiceChannel
            .getRoleServiceBlockingStub()
            .setRoleBinding(SetRoleBinding.newBuilder().setRoleBinding(roleBinding).build());
    LOGGER.info(ModelDBMessages.ROLE_SERVICE_RES_RECEIVED_MSG);
    LOGGER.trace(ModelDBMessages.ROLE_SERVICE_RES_RECEIVED_TRACE_MSG, setRoleBindingResponse);
  } catch (StatusRuntimeException ex) {
    ModelDBUtils.retryOrThrowException(
        ex,
        retry,
        (ModelDBUtils.RetryCallInterface<Void>)
            (retry1) -> {
              setRoleBindingOnAuthService(retry1, roleBinding);
              return null;
            });
  }
}
 
Example #21
Source File: GeographicViewServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void getGeographicViewExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockGeographicViewService.addException(exception);

  try {
    String formattedResourceName =
        GeographicViewServiceClient.formatGeographicViewName("[CUSTOMER]", "[GEOGRAPHIC_VIEW]");

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

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

    client.mutateAdGroupBidModifiers(customerId, operations);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example #23
Source File: MetaClient.java    From paraflow with Apache License 2.0 6 votes vote down vote up
public MetaProto.StringListType listColumnsDataType(String dbName, String tblName)
{
    MetaProto.DbNameParam dbNameParam = MetaProto.DbNameParam.newBuilder()
            .setDatabase(dbName)
            .build();
    MetaProto.TblNameParam tblNameParam = MetaProto.TblNameParam.newBuilder()
            .setTable(tblName)
            .build();
    MetaProto.DbTblParam dbTblParam = MetaProto.DbTblParam.newBuilder()
            .setDatabase(dbNameParam)
            .setTable(tblNameParam)
            .build();
    MetaProto.StringListType stringList;
    try {
        stringList = metaBlockingStub.listColumnsDataType(dbTblParam);
    }
    catch (StatusRuntimeException e) {
        logger.warn("RPC failed: " + e.getStatus());
        stringList = MetaProto.StringListType.newBuilder().build();
        return stringList;
    }
    logger.debug("ColumnsDataType list : " + stringList);
    return stringList;
}
 
Example #24
Source File: MetaClient.java    From paraflow with Apache License 2.0 6 votes vote down vote up
public MetaProto.TblParam getTable(String dbName, String tblName)
{
    logger.info("dbName & tblName: " + dbName + "," + tblName);
    MetaProto.DbNameParam databaseName = MetaProto.DbNameParam.newBuilder()
            .setDatabase(dbName)
            .build();
    MetaProto.TblNameParam tableName = MetaProto.TblNameParam.newBuilder()
            .setTable(tblName)
            .build();
    MetaProto.DbTblParam databaseTable = MetaProto.DbTblParam.newBuilder()
            .setDatabase(databaseName)
            .setTable(tableName)
            .build();
    MetaProto.TblParam table;
    try {
        table = metaBlockingStub.getTable(databaseTable);
    }
    catch (StatusRuntimeException e) {
        logger.warn("RPC failed: " + e.getStatus());
        table = MetaProto.TblParam.newBuilder().build();
        return table;
    }
    logger.debug("Table is : " + table);
    return table;
}
 
Example #25
Source File: UserListServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateUserListsExceptionTest2() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockUserListService.addException(exception);

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

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

  try {
    String formattedResourceName =
        KeywordPlanKeywordServiceClient.formatKeywordPlanKeywordName(
            "[CUSTOMER]", "[KEYWORD_PLAN_KEYWORD]");

    client.getKeywordPlanKeyword(formattedResourceName);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}
 
Example #27
Source File: ChannelzService.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
/** Returns a socket. */
@Override
public void getSocket(
    GetSocketRequest request, StreamObserver<GetSocketResponse> responseObserver) {
  InternalInstrumented<SocketStats> s = channelz.getSocket(request.getSocketId());
  if (s == null) {
    responseObserver.onError(
        Status.NOT_FOUND.withDescription("Can't find socket " + request.getSocketId())
            .asRuntimeException());
    return;
  }

  GetSocketResponse resp;
  try {
    resp =
        GetSocketResponse.newBuilder().setSocket(ChannelzProtoUtil.toSocket(s)).build();
  } catch (StatusRuntimeException e) {
    responseObserver.onError(e);
    return;
  }

  responseObserver.onNext(resp);
  responseObserver.onCompleted();
}
 
Example #28
Source File: SpnegoAuthenticatorTest.java    From gcp-token-broker with Apache License 2.0 6 votes vote down vote up
@Test
public void testInvalidKeytab() throws Exception {
    Path fakeKeytab = Files.createTempFile("fake", ".keytab");
    List<Map<String, String>> config = List.of(Map.of(
        "keytab", fakeKeytab.toString(),
        "principal", "blah"
    ));
    try (SettingsOverride override = SettingsOverride.apply(Map.of(AppSettings.KEYTABS, config))) {
        try {
            String token = generateSpnegoToken("alice");
            SpnegoAuthenticator auth = new SpnegoAuthenticator();
            auth.authenticateUser("Negotiate " + token);
            fail();
        } catch (StatusRuntimeException e) {
            assertEquals(Status.UNAUTHENTICATED.getCode(), e.getStatus().getCode());
            assertEquals("UNAUTHENTICATED: SPNEGO authentication failed", e.getMessage());
        }
    }
}
 
Example #29
Source File: KeywordPlanServiceClientTest.java    From google-ads-java with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("all")
public void mutateKeywordPlansExceptionTest() throws Exception {
  StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
  mockKeywordPlanService.addException(exception);

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

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

  try {
    String customerId = "customerId-1772061412";
    Customer customerClient = Customer.newBuilder().build();
    StringValue emailAddress = StringValue.newBuilder().build();
    AccessRoleEnum.AccessRole accessRole = AccessRoleEnum.AccessRole.UNSPECIFIED;

    client.createCustomerClient(customerId, customerClient, emailAddress, accessRole);
    Assert.fail("No exception raised");
  } catch (InvalidArgumentException e) {
    // Expected exception
  }
}