MobileDeviceConstantServiceClient implements BackgroundResource { public final MobileDeviceConstant getMobileDeviceConstant(MobileDeviceConstantName resourceName) { GetMobileDeviceConstantRequest request = GetMobileDeviceConstantRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getMobileDeviceConstant(request); } protected  MobileDeviceConstantServiceClient(MobileDeviceConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  MobileDeviceConstantServiceClient(MobileDeviceConstantServiceStub stub); static final MobileDeviceConstantServiceClient create(); static final MobileDeviceConstantServiceClient create(
      MobileDeviceConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final MobileDeviceConstantServiceClient create(
      MobileDeviceConstantServiceStub stub); final MobileDeviceConstantServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") MobileDeviceConstantServiceStub getStub(); final MobileDeviceConstant getMobileDeviceConstant(MobileDeviceConstantName resourceName); final MobileDeviceConstant getMobileDeviceConstant(String resourceName); final MobileDeviceConstant getMobileDeviceConstant(
      GetMobileDeviceConstantRequest request); final UnaryCallable<GetMobileDeviceConstantRequest, MobileDeviceConstant> getMobileDeviceConstantCallable(); @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 getMobileDeviceConstantTest() { com.google.ads.googleads.v5.services.MobileDeviceConstantName resourceName2 = com.google.ads.googleads.v5.services.MobileDeviceConstantName.of( "[MOBILE_DEVICE_CONSTANT]"); long id = 3355L; com.google.ads.googleads.v5.services.MobileDeviceConstantName name = com.google.ads.googleads.v5.services.MobileDeviceConstantName.of( "[MOBILE_DEVICE_CONSTANT]"); String manufacturerName = "manufacturerName-1949119943"; String operatingSystemName = "operatingSystemName-1624170339"; MobileDeviceConstant expectedResponse = MobileDeviceConstant.newBuilder() .setResourceName(resourceName2.toString()) .setId(id) .setName(name.toString()) .setManufacturerName(manufacturerName) .setOperatingSystemName(operatingSystemName) .build(); mockMobileDeviceConstantService.addResponse(expectedResponse); MobileDeviceConstantName resourceName = MobileDeviceConstantName.of("[MOBILE_DEVICE_CONSTANT]"); MobileDeviceConstant actualResponse = client.getMobileDeviceConstant(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockMobileDeviceConstantService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetMobileDeviceConstantRequest actualRequest = (GetMobileDeviceConstantRequest) actualRequests.get(0); Assert.assertEquals( resourceName, MobileDeviceConstantName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getMobileDeviceConstantExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockMobileDeviceConstantService.addException(exception); try { MobileDeviceConstantName resourceName = MobileDeviceConstantName.of("[MOBILE_DEVICE_CONSTANT]"); client.getMobileDeviceConstant(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }