MerchantCenterLinkServiceClient implements BackgroundResource { public final MerchantCenterLink getMerchantCenterLink(MerchantCenterLinkName resourceName) { GetMerchantCenterLinkRequest request = GetMerchantCenterLinkRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getMerchantCenterLink(request); } protected  MerchantCenterLinkServiceClient(MerchantCenterLinkServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  MerchantCenterLinkServiceClient(MerchantCenterLinkServiceStub stub); static final MerchantCenterLinkServiceClient create(); static final MerchantCenterLinkServiceClient create(
      MerchantCenterLinkServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final MerchantCenterLinkServiceClient create(MerchantCenterLinkServiceStub stub); final MerchantCenterLinkServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") MerchantCenterLinkServiceStub getStub(); final ListMerchantCenterLinksResponse listMerchantCenterLinks(String customerId); final ListMerchantCenterLinksResponse listMerchantCenterLinks(
      ListMerchantCenterLinksRequest request); final UnaryCallable<ListMerchantCenterLinksRequest, ListMerchantCenterLinksResponse> listMerchantCenterLinksCallable(); final MerchantCenterLink getMerchantCenterLink(MerchantCenterLinkName resourceName); final MerchantCenterLink getMerchantCenterLink(String resourceName); final MerchantCenterLink getMerchantCenterLink(GetMerchantCenterLinkRequest request); final UnaryCallable<GetMerchantCenterLinkRequest, MerchantCenterLink> getMerchantCenterLinkCallable(); final MutateMerchantCenterLinkResponse mutateMerchantCenterLink(
      String customerId, MerchantCenterLinkOperation operation); final MutateMerchantCenterLinkResponse mutateMerchantCenterLink(
      MutateMerchantCenterLinkRequest request); final UnaryCallable<MutateMerchantCenterLinkRequest, MutateMerchantCenterLinkResponse> mutateMerchantCenterLinkCallable(); @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 getMerchantCenterLinkTest() { com.google.ads.googleads.v5.services.MerchantCenterLinkName resourceName2 = com.google.ads.googleads.v5.services.MerchantCenterLinkName.of( "[CUSTOMER]", "[MERCHANT_CENTER_LINK]"); long id = 3355L; String merchantCenterAccountName = "merchantCenterAccountName-835145712"; MerchantCenterLink expectedResponse = MerchantCenterLink.newBuilder() .setResourceName(resourceName2.toString()) .setId(id) .setMerchantCenterAccountName(merchantCenterAccountName) .build(); mockMerchantCenterLinkService.addResponse(expectedResponse); MerchantCenterLinkName resourceName = MerchantCenterLinkName.of("[CUSTOMER]", "[MERCHANT_CENTER_LINK]"); MerchantCenterLink actualResponse = client.getMerchantCenterLink(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockMerchantCenterLinkService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetMerchantCenterLinkRequest actualRequest = (GetMerchantCenterLinkRequest) actualRequests.get(0); Assert.assertEquals( resourceName, MerchantCenterLinkName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getMerchantCenterLinkExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockMerchantCenterLinkService.addException(exception); try { MerchantCenterLinkName resourceName = MerchantCenterLinkName.of("[CUSTOMER]", "[MERCHANT_CENTER_LINK]"); client.getMerchantCenterLink(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }