Skip to content

Commit fd03bf2

Browse files
committed
chore: correct lint errors
1 parent cceee4e commit fd03bf2

File tree

1 file changed

+55
-52
lines changed

1 file changed

+55
-52
lines changed

samples/snippets/src/test/java/com/example/storage/ITObjectSnippets.java

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
import com.example.storage.object.GenerateEncryptionKey;
4444
import com.example.storage.object.GenerateV4GetObjectSignedUrl;
4545
import com.example.storage.object.GenerateV4PutObjectSignedUrl;
46-
import com.example.storage.object.GetObjectMetadata;
4746
import com.example.storage.object.GetObjectContexts;
47+
import com.example.storage.object.GetObjectMetadata;
4848
import com.example.storage.object.ListObjectContexts;
4949
import com.example.storage.object.ListObjects;
5050
import com.example.storage.object.ListObjectsWithOldVersions;
@@ -68,8 +68,8 @@
6868
import com.google.cloud.storage.Blob;
6969
import com.google.cloud.storage.BlobId;
7070
import com.google.cloud.storage.BlobInfo;
71-
import com.google.cloud.storage.BlobInfo.ObjectCustomContextPayload;
7271
import com.google.cloud.storage.BlobInfo.ObjectContexts;
72+
import com.google.cloud.storage.BlobInfo.ObjectCustomContextPayload;
7373
import com.google.cloud.storage.Bucket;
7474
import com.google.cloud.storage.BucketInfo;
7575
import com.google.cloud.storage.BucketInfo.IamConfiguration;
@@ -638,69 +638,72 @@ public void testRestoreSoftDeletedObject() throws Exception {
638638
}
639639
}
640640

641-
@Test
642-
public void testSetObjectContexts() throws Exception {
643-
String blobName = generator.randomObjectName();
644-
String key = "test-key-get";
645-
String value = "test-value-get";
641+
@Test
642+
public void testSetObjectContexts() throws Exception {
643+
String blobName = generator.randomObjectName();
644+
String key = "test-key-get";
645+
String value = "test-value-get";
646646

647-
Blob initialBlob = storage.create(info(blobName), CONTENT, BlobTargetOption.doesNotExist());
647+
Blob initialBlob = storage.create(info(blobName), CONTENT, BlobTargetOption.doesNotExist());
648648

649-
SetObjectContexts.setObjectContexts(
650-
GOOGLE_CLOUD_PROJECT, bucket.getName(), blobName, key, value);
651-
String setOutput = stdOut.getCapturedOutputAsUtf8String();
652-
assertThat(setOutput).contains("Updated custom contexts for object " + blobName);
649+
SetObjectContexts.setObjectContexts(
650+
GOOGLE_CLOUD_PROJECT, bucket.getName(), blobName, key, value);
651+
String setOutput = stdOut.getCapturedOutputAsUtf8String();
652+
assertThat(setOutput).contains("Updated custom contexts for object " + blobName);
653653

654-
Blob updatedBlob = storage.get(bucket.getName(), blobName);
655-
assertThat(updatedBlob.getContexts().getCustom().get(key).getValue()).isEqualTo(value);
656-
}
654+
Blob updatedBlob = storage.get(bucket.getName(), blobName);
655+
assertThat(updatedBlob.getContexts().getCustom().get(key).getValue()).isEqualTo(value);
656+
}
657657

658-
@Test
659-
public void testGetObjectContexts() throws Exception {
660-
String blobName = generator.randomObjectName();
661-
String key = "test-key-get";
662-
String value = "test-value-get";
658+
@Test
659+
public void testGetObjectContexts() throws Exception {
660+
String blobName = generator.randomObjectName();
661+
String key = "test-key-get";
662+
String value = "test-value-get";
663663

664-
storage.create(info(blobName), CONTENT, BlobTargetOption.doesNotExist());
664+
storage.create(info(blobName), CONTENT, BlobTargetOption.doesNotExist());
665665

666-
ObjectCustomContextPayload payload =
667-
ObjectCustomContextPayload.newBuilder().setValue(value).build();
668-
Map<String, ObjectCustomContextPayload> custom = Maps.newHashMap();
669-
custom.put(key, payload);
670-
ObjectContexts contexts = ObjectContexts.newBuilder().setCustom(custom).build();
671-
BlobInfo pendingUpdate = storage.get(bucket.getName(), blobName).toBuilder().setContexts(contexts).build();
672-
storage.update(pendingUpdate);
666+
ObjectCustomContextPayload payload =
667+
ObjectCustomContextPayload.newBuilder().setValue(value).build();
668+
Map<String, ObjectCustomContextPayload> custom = Maps.newHashMap();
669+
custom.put(key, payload);
670+
ObjectContexts contexts = ObjectContexts.newBuilder().setCustom(custom).build();
671+
BlobInfo pendingUpdate =
672+
storage.get(bucket.getName(), blobName).toBuilder().setContexts(contexts).build();
673+
storage.update(pendingUpdate);
673674

674-
GetObjectContexts.getObjectContexts(GOOGLE_CLOUD_PROJECT, bucket.getName(), blobName);
675+
GetObjectContexts.getObjectContexts(GOOGLE_CLOUD_PROJECT, bucket.getName(), blobName);
675676

676-
String getOutput = stdOut.getCapturedOutputAsUtf8String();
677+
String getOutput = stdOut.getCapturedOutputAsUtf8String();
677678

678-
assertThat(getOutput).contains("Custom Contexts:");
679-
assertThat(getOutput).contains(key + "=ObjectCustomContextPayload{");
680-
assertThat(getOutput).contains("value=" + value);
681-
}
679+
assertThat(getOutput).contains("Custom Contexts:");
680+
assertThat(getOutput).contains(key + "=ObjectCustomContextPayload{");
681+
assertThat(getOutput).contains("value=" + value);
682+
}
682683

683-
@Test
684-
public void testListObjectContexts() throws Exception {
685-
String blobName = generator.randomObjectName();
686-
String key = "test-key-list";
687-
String value = "test-value-list";
684+
@Test
685+
public void testListObjectContexts() throws Exception {
686+
String blobName = generator.randomObjectName();
687+
String key = "test-key-list";
688+
String value = "test-value-list";
688689

689-
storage.create(info(blobName), CONTENT, BlobTargetOption.doesNotExist());
690+
storage.create(info(blobName), CONTENT, BlobTargetOption.doesNotExist());
690691

691-
ObjectCustomContextPayload payload =
692-
ObjectCustomContextPayload.newBuilder().setValue(value).build();
693-
Map<String, ObjectCustomContextPayload> custom = Maps.newHashMap();
694-
custom.put(key, payload);
695-
ObjectContexts contexts = ObjectContexts.newBuilder().setCustom(custom).build();
696-
BlobInfo pendingUpdate = storage.get(bucket.getName(), blobName).toBuilder().setContexts(contexts).build();
697-
storage.update(pendingUpdate);
692+
ObjectCustomContextPayload payload =
693+
ObjectCustomContextPayload.newBuilder().setValue(value).build();
694+
Map<String, ObjectCustomContextPayload> custom = Maps.newHashMap();
695+
custom.put(key, payload);
696+
ObjectContexts contexts = ObjectContexts.newBuilder().setCustom(custom).build();
697+
BlobInfo pendingUpdate =
698+
storage.get(bucket.getName(), blobName).toBuilder().setContexts(contexts).build();
699+
storage.update(pendingUpdate);
698700

699-
ListObjectContexts.listObjectContexts(GOOGLE_CLOUD_PROJECT, bucket.getName(), key);
700-
String listOutput = stdOut.getCapturedOutputAsUtf8String();
701+
ListObjectContexts.listObjectContexts(GOOGLE_CLOUD_PROJECT, bucket.getName(), key);
702+
String listOutput = stdOut.getCapturedOutputAsUtf8String();
701703

702-
assertThat(listOutput).contains("gs://" + bucket.getName() + "/" + blobName);
704+
assertThat(listOutput).contains("gs://" + bucket.getName() + "/" + blobName);
703705

704-
assertThat(listOutput).contains("Listing objects for bucket: " + bucket.getName() + "with context key: " + key);
705-
}
706+
assertThat(listOutput)
707+
.contains("Listing objects for bucket: " + bucket.getName() + "with context key: " + key);
708+
}
706709
}

0 commit comments

Comments
 (0)