File tree Expand file tree Collapse file tree 4 files changed +14
-3
lines changed
datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client
google-cloud-datastore/src
main/java/com/google/cloud/datastore
test/java/com/google/cloud/datastore Expand file tree Collapse file tree 4 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,7 @@ public String getProjectId() {
188188 return projectId ;
189189 }
190190
191+ @ BetaApi
191192 public String getDatabaseId () {
192193 return databaseId ;
193194 }
Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ public String getNamespace() {
148148 return namespace ;
149149 }
150150
151+ @ BetaApi
151152 public String getDatabaseId () {
152153 return databaseId ;
153154 }
Original file line number Diff line number Diff line change @@ -155,6 +155,7 @@ public String getNamespace() {
155155 return namespace ;
156156 }
157157
158+ @ BetaApi
158159 public String getDatabaseId () {
159160 return this .databaseId ;
160161 }
@@ -193,7 +194,7 @@ public Builder toBuilder() {
193194
194195 @ Override
195196 public int hashCode () {
196- return Objects .hash (baseHashCode (), namespace );
197+ return Objects .hash (baseHashCode (), namespace , databaseId );
197198 }
198199
199200 @ Override
@@ -202,7 +203,9 @@ public boolean equals(Object obj) {
202203 return false ;
203204 }
204205 DatastoreOptions other = (DatastoreOptions ) obj ;
205- return baseEquals (other ) && Objects .equals (namespace , other .namespace );
206+ return baseEquals (other )
207+ && Objects .equals (namespace , other .namespace )
208+ && Objects .equals (databaseId , other .databaseId );
206209 }
207210
208211 public static Builder newBuilder () {
Original file line number Diff line number Diff line change 1717package com .google .cloud .datastore ;
1818
1919import static org .junit .Assert .assertEquals ;
20+ import static org .junit .Assert .assertNotEquals ;
2021import static org .junit .Assert .assertNotNull ;
2122import static org .junit .Assert .assertSame ;
2223import static org .junit .Assert .assertTrue ;
@@ -38,7 +39,6 @@ public class DatastoreOptionsTest {
3839 private DatastoreRpc datastoreRpc ;
3940 private DatastoreOptions .Builder options ;
4041
41- // todo parameterize
4242 @ Before
4343 public void setUp () {
4444 datastoreRpcFactory = EasyMock .createMock (DatastoreRpcFactory .class );
@@ -90,6 +90,12 @@ public void testToBuilder() {
9090 assertEquals (original .getHost (), copy .getHost ());
9191 assertEquals (original .getRetrySettings (), copy .getRetrySettings ());
9292 assertEquals (original .getCredentials (), copy .getCredentials ());
93+ assertEquals (original , copy );
94+ assertEquals (original .hashCode (), copy .hashCode ());
95+
96+ DatastoreOptions newOptions = options .setDatabaseId ("new-database-id" ).build ();
97+ assertNotEquals (original , newOptions );
98+ assertNotEquals (original .hashCode (), newOptions .hashCode ());
9399 }
94100
95101 @ Test
You can’t perform that action at this time.
0 commit comments