AssetServiceClient implements BackgroundResource { public final Asset getAsset(AssetName resourceName) { GetAssetRequest request = GetAssetRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getAsset(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 getAssetTest() { com.google.ads.googleads.v5.services.AssetName resourceName2 = com.google.ads.googleads.v5.services.AssetName.of("[CUSTOMER]", "[ASSET]"); long id = 3355L; com.google.ads.googleads.v5.services.AssetName name = com.google.ads.googleads.v5.services.AssetName.of("[CUSTOMER]", "[ASSET]"); Asset expectedResponse = Asset.newBuilder() .setResourceName(resourceName2.toString()) .setId(id) .setName(name.toString()) .build(); mockAssetService.addResponse(expectedResponse); AssetName resourceName = AssetName.of("[CUSTOMER]", "[ASSET]"); Asset actualResponse = client.getAsset(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAssetService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetAssetRequest actualRequest = (GetAssetRequest) actualRequests.get(0); Assert.assertEquals(resourceName, AssetName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getAssetExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockAssetService.addException(exception); try { AssetName resourceName = AssetName.of("[CUSTOMER]", "[ASSET]"); client.getAsset(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }