Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,10 @@ public void testCreateAppProfileAddRowAffinityAddSetOfClusterIds() {
// Setup
Mockito.when(mockStub.createAppProfileCallable()).thenReturn(mockCreateAppProfileCallable);

Set<String> clusterIds = new HashSet<String>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the primary goal is have stable ordering:

  1. add a comment to make it explicit
  2. use a List or an OrderedHashSet

clusterIds.add("cluster-id-1");
clusterIds.add("cluster-id-2");

com.google.bigtable.admin.v2.CreateAppProfileRequest expectedRequest =
com.google.bigtable.admin.v2.CreateAppProfileRequest.newBuilder()
.setParent(NameUtil.formatInstanceName(PROJECT_ID, INSTANCE_ID))
Expand All @@ -1225,8 +1229,7 @@ public void testCreateAppProfileAddRowAffinityAddSetOfClusterIds() {
.setMultiClusterRoutingUseAny(
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
.newBuilder()
.addClusterIds("cluster-id-1")
.addClusterIds("cluster-id-2")
.addAllClusterIds(clusterIds)
.setRowAffinity(
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
.RowAffinity.newBuilder()
Expand All @@ -1239,8 +1242,7 @@ public void testCreateAppProfileAddRowAffinityAddSetOfClusterIds() {
.setDescription("my description")
.setMultiClusterRoutingUseAny(
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.newBuilder()
.addClusterIds("cluster-id-1")
.addClusterIds("cluster-id-2")
.addAllClusterIds(clusterIds)
.setRowAffinity(
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
.RowAffinity.newBuilder()
Expand All @@ -1251,9 +1253,6 @@ public void testCreateAppProfileAddRowAffinityAddSetOfClusterIds() {
.thenReturn(ApiFutures.immediateFuture(expectedResponse));

// Execute
Set<String> clusterIds = new HashSet<String>();
clusterIds.add("cluster-id-1");
clusterIds.add("cluster-id-2");
AppProfile actualResult =
adminClient.createAppProfile(
CreateAppProfileRequest.of(INSTANCE_ID, APP_PROFILE_ID)
Expand Down
Loading