OperatingSystemVersionConstantServiceClient implements BackgroundResource { public final OperatingSystemVersionConstant getOperatingSystemVersionConstant( OperatingSystemVersionConstantName resourceName) { GetOperatingSystemVersionConstantRequest request = GetOperatingSystemVersionConstantRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getOperatingSystemVersionConstant(request); } protected  OperatingSystemVersionConstantServiceClient(
      OperatingSystemVersionConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  OperatingSystemVersionConstantServiceClient(
      OperatingSystemVersionConstantServiceStub stub); static final OperatingSystemVersionConstantServiceClient create(); static final OperatingSystemVersionConstantServiceClient create(
      OperatingSystemVersionConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final OperatingSystemVersionConstantServiceClient create(
      OperatingSystemVersionConstantServiceStub stub); final OperatingSystemVersionConstantServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") OperatingSystemVersionConstantServiceStub getStub(); final OperatingSystemVersionConstant getOperatingSystemVersionConstant(
      OperatingSystemVersionConstantName resourceName); final OperatingSystemVersionConstant getOperatingSystemVersionConstant(
      String resourceName); final OperatingSystemVersionConstant getOperatingSystemVersionConstant(
      GetOperatingSystemVersionConstantRequest request); final UnaryCallable<
          GetOperatingSystemVersionConstantRequest, OperatingSystemVersionConstant> getOperatingSystemVersionConstantCallable(); @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 getOperatingSystemVersionConstantTest() { com.google.ads.googleads.v5.services.OperatingSystemVersionConstantName resourceName2 = com.google.ads.googleads.v5.services.OperatingSystemVersionConstantName.of( "[OPERATING_SYSTEM_VERSION_CONSTANT]"); long id = 3355L; com.google.ads.googleads.v5.services.OperatingSystemVersionConstantName name = com.google.ads.googleads.v5.services.OperatingSystemVersionConstantName.of( "[OPERATING_SYSTEM_VERSION_CONSTANT]"); int osMajorVersion = 1346408137; int osMinorVersion = 1088382771; OperatingSystemVersionConstant expectedResponse = OperatingSystemVersionConstant.newBuilder() .setResourceName(resourceName2.toString()) .setId(id) .setName(name.toString()) .setOsMajorVersion(osMajorVersion) .setOsMinorVersion(osMinorVersion) .build(); mockOperatingSystemVersionConstantService.addResponse(expectedResponse); OperatingSystemVersionConstantName resourceName = OperatingSystemVersionConstantName.of("[OPERATING_SYSTEM_VERSION_CONSTANT]"); OperatingSystemVersionConstant actualResponse = client.getOperatingSystemVersionConstant(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockOperatingSystemVersionConstantService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetOperatingSystemVersionConstantRequest actualRequest = (GetOperatingSystemVersionConstantRequest) actualRequests.get(0); Assert.assertEquals( resourceName, OperatingSystemVersionConstantName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getOperatingSystemVersionConstantExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockOperatingSystemVersionConstantService.addException(exception); try { OperatingSystemVersionConstantName resourceName = OperatingSystemVersionConstantName.of("[OPERATING_SYSTEM_VERSION_CONSTANT]"); client.getOperatingSystemVersionConstant(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }