MediaFileServiceClient implements BackgroundResource { public final MutateMediaFilesResponse mutateMediaFiles( String customerId, List<MediaFileOperation> operations) { MutateMediaFilesRequest request = MutateMediaFilesRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateMediaFiles(request); } protected  MediaFileServiceClient(MediaFileServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  MediaFileServiceClient(MediaFileServiceStub stub); static final MediaFileServiceClient create(); static final MediaFileServiceClient create(MediaFileServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final MediaFileServiceClient create(MediaFileServiceStub stub); final MediaFileServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") MediaFileServiceStub getStub(); final MediaFile getMediaFile(MediaFileName resourceName); final MediaFile getMediaFile(String resourceName); final MediaFile getMediaFile(GetMediaFileRequest request); final UnaryCallable<GetMediaFileRequest, MediaFile> getMediaFileCallable(); final MutateMediaFilesResponse mutateMediaFiles(
      String customerId, List<MediaFileOperation> operations); final MutateMediaFilesResponse mutateMediaFiles(MutateMediaFilesRequest request); final UnaryCallable<MutateMediaFilesRequest, MutateMediaFilesResponse> mutateMediaFilesCallable(); @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 mutateMediaFilesTest() { MutateMediaFilesResponse expectedResponse = MutateMediaFilesResponse.newBuilder().build(); mockMediaFileService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<MediaFileOperation> operations = new ArrayList<>(); MutateMediaFilesResponse actualResponse = client.mutateMediaFiles(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockMediaFileService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateMediaFilesRequest actualRequest = (MutateMediaFilesRequest) 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 mutateMediaFilesExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockMediaFileService.addException(exception); try { String customerId = "customerId-1772061412"; List<MediaFileOperation> operations = new ArrayList<>(); client.mutateMediaFiles(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }