@@ -0,0 +1,2470 @@
+/*%0A * Copyright 2019 Google LLC. All Rights Reserved.%0A *%0A *  Licensed under the Apache License, Version 2.0 (the %22License%22); you may not use this file except%0A * in compliance with the License. You may obtain a copy of the License at%0A *%0A *  http://www.apache.org/licenses/LICENSE-2.0%0A *%0A *  Unless required by applicable law or agreed to in writing, software distributed under the%0A * License is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either%0A * express or implied. See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.google.cloud.hadoop.gcsio;%0A%0Aimport static com.google.cloud.hadoop.gcsio.GoogleCloudStorageTestUtils.BUCKET_NAME;%0Aimport static com.google.cloud.hadoop.gcsio.GoogleCloudStorageTestUtils.HTTP_TRANSPORT;%0Aimport static com.google.cloud.hadoop.gcsio.GoogleCloudStorageTestUtils.JSON_FACTORY;%0Aimport static com.google.cloud.hadoop.gcsio.GoogleCloudStorageTestUtils.OBJECT_NAME;%0Aimport static com.google.common.truth.Truth.assertThat;%0A%0Aimport com.google.api.client.http.InputStreamContent;%0Aimport com.google.api.services.storage.Storage;%0Aimport com.google.cloud.hadoop.util.AsyncWriteChannelOptions;%0Aimport com.google.cloud.hadoop.util.ClientRequestHelper;%0Aimport com.google.common.util.concurrent.MoreExecutors;%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.IOException;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.JUnit4;%0A%0A/** Unit tests for %7B@link GoogleCloudStorageWriteChannel%7D class. */%0A@RunWith(JUnit4.class)%0Apublic class GoogleCloudStorageWriteChannelTest %7B%0A%0A  @Test%0A  public void createRequest_shouldSetKmsKeyName() throws IOException %7B%0A    String kmsKeyName = %22testKmsKey%22;%0A%0A    GoogleCloudStorageWriteChannel writeChannel =%0A        new GoogleCloudStorageWriteChannel(%0A            MoreExecutors.newDirectExecutorService(),%0A            new Storage(HTTP_TRANSPORT, JSON_FACTORY, r -%3E %7B%7D),%0A            new ClientRequestHelper%3C%3E(),%0A            BUCKET_NAME,%0A            OBJECT_NAME,%0A            %22content-type%22,%0A            kmsKeyName,%0A            AsyncWriteChannelOptions.builder().build(),%0A            new ObjectWriteConditions(),%0A            /* objectMetadata= */ null);%0A%0A    Storage.Objects.Insert request =%0A        writeChannel.createRequest(%0A            new InputStreamContent(%22plain/text%22, new ByteArrayInputStream(new byte%5B0%5D)));%0A%0A    assertThat(request.getKmsKeyName()).isEqualTo(kmsKeyName);%0A  %7D%0A%7D%0A

Test for GoogleCloudStorageWriteChannel (#196)