Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sai-sunder-s committed Jan 17, 2024
1 parent cabc7af commit e9e49e2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Expand Up @@ -140,6 +140,12 @@ public Builder setAuthPort(int authPort) {
return this;
}

@CanIgnoreReturnValue
public Builder setQuotaProjectId(String quotaProjectId) {
super.quotaProjectId = quotaProjectId;
return this;
}

public int getAuthPort() {
return authPort;
}
Expand Down
Expand Up @@ -124,4 +124,20 @@ public void serialize() throws IOException, ClassNotFoundException {
assertEquals(credentials.toString(), deserializedCredentials.toString());
assertSame(deserializedCredentials.clock, Clock.SYSTEM);
}

@Test
public void toBuilder() {
CloudShellCredentials credentials =
CloudShellCredentials.newBuilder()
.setAuthPort(42)
.setQuotaProjectId("quota-project")
.build();

assertEquals(42, credentials.getAuthPort());
assertEquals("quota-project", credentials.getQuotaProjectId());

CloudShellCredentials secondCredentials = credentials.toBuilder().build();

assertEquals(credentials, secondCredentials);
}
}

0 comments on commit e9e49e2

Please sign in to comment.