Skip to content

Commit

Permalink
test: improve code coverage and lint fixes
Browse files Browse the repository at this point in the history
Change-Id: I69e1302a3540ceb00960957ae25d98f291059a6f
  • Loading branch information
ad548 committed Mar 13, 2021
1 parent 040f669 commit d8c2286
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Expand Up @@ -48,12 +48,12 @@ public void testFromProto() {
.setMessage("kms is unavailable")
.build();

com.google.bigtable.admin.v2.EncryptionInfo proto = com.google.bigtable.admin.v2.EncryptionInfo
.newBuilder()
.setEncryptionType(EncryptionType.CUSTOMER_MANAGED_ENCRYPTION)
.setKmsKeyVersion("some version")
.setEncryptionStatus(protoStatus)
.build();
com.google.bigtable.admin.v2.EncryptionInfo proto =
com.google.bigtable.admin.v2.EncryptionInfo.newBuilder()
.setEncryptionType(EncryptionType.CUSTOMER_MANAGED_ENCRYPTION)
.setKmsKeyVersion("some version")
.setEncryptionStatus(protoStatus)
.build();
EncryptionInfo encryptionInfo = EncryptionInfo.fromProto(proto);

assertThat(encryptionInfo.getStatus()).isEqualTo(Status.fromProto(protoStatus));
Expand Down
Expand Up @@ -25,6 +25,7 @@

@RunWith(JUnit4.class)
public class StatusTest {

@Test
public void testAllCodes() {
for (Code protoValue : com.google.rpc.Code.values()) {
Expand Down Expand Up @@ -65,14 +66,17 @@ public void testFromProto() {

@Test
public void testToProto() {
com.google.rpc.Code code = Code.UNAVAILABLE;
com.google.rpc.Status proto =
com.google.rpc.Status.newBuilder()
.setCode(Code.UNAVAILABLE.getNumber())
.setCode(code.getNumber())
.setMessage("some message")
.build();

Status model = Status.fromProto(proto);
assertThat(model.getCode().toProto()).isEqualTo(code);
assertThat(model.toProto()).isEqualTo(proto);

assertThat(model.toString()).isEqualTo(proto.toString());
}
}

0 comments on commit d8c2286

Please sign in to comment.