AssetServiceClient implements BackgroundResource { public final MutateAssetsResponse mutateAssets( String customerId, List<AssetOperation> operations) { MutateAssetsRequest request = MutateAssetsRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateAssets(request); } protected  AssetServiceClient(AssetServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  AssetServiceClient(AssetServiceStub stub); static final AssetServiceClient create(); static final AssetServiceClient create(AssetServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final AssetServiceClient create(AssetServiceStub stub); final AssetServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") AssetServiceStub getStub(); final Asset getAsset(AssetName resourceName); final Asset getAsset(String resourceName); final Asset getAsset(GetAssetRequest request); final UnaryCallable<GetAssetRequest, Asset> getAssetCallable(); final MutateAssetsResponse mutateAssets(
      String customerId, List<AssetOperation> operations); final MutateAssetsResponse mutateAssets(MutateAssetsRequest request); final UnaryCallable<MutateAssetsRequest, MutateAssetsResponse> mutateAssetsCallable(); @Override final void close(); @Override void shutdown(); @Override boolean isShutdown(); @Override boolean isTerminated(); @Override void shutdownNow(); @Override boolean awaitTermination(long duration, TimeUnit unit);  }
@Test @SuppressWarnings("all") public void mutateAssetsTest() { MutateAssetsResponse expectedResponse = MutateAssetsResponse.newBuilder().build(); mockAssetService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<AssetOperation> operations = new ArrayList<>(); MutateAssetsResponse actualResponse = client.mutateAssets(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAssetService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateAssetsRequest actualRequest = (MutateAssetsRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operations, actualRequest.getOperationsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void mutateAssetsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockAssetService.addException(exception); try { String customerId = "customerId-1772061412"; List<AssetOperation> operations = new ArrayList<>(); client.mutateAssets(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }