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 4 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,7 @@ public String getProjectId() {
188
188
return projectId ;
189
189
}
190
190
191
+ @ BetaApi
191
192
public String getDatabaseId () {
192
193
return databaseId ;
193
194
}
Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ public String getNamespace() {
148
148
return namespace ;
149
149
}
150
150
151
+ @ BetaApi
151
152
public String getDatabaseId () {
152
153
return databaseId ;
153
154
}
Original file line number Diff line number Diff line change @@ -155,6 +155,7 @@ public String getNamespace() {
155
155
return namespace ;
156
156
}
157
157
158
+ @ BetaApi
158
159
public String getDatabaseId () {
159
160
return this .databaseId ;
160
161
}
@@ -193,7 +194,7 @@ public Builder toBuilder() {
193
194
194
195
@ Override
195
196
public int hashCode () {
196
- return Objects .hash (baseHashCode (), namespace );
197
+ return Objects .hash (baseHashCode (), namespace , databaseId );
197
198
}
198
199
199
200
@ Override
@@ -202,7 +203,9 @@ public boolean equals(Object obj) {
202
203
return false ;
203
204
}
204
205
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 );
206
209
}
207
210
208
211
public static Builder newBuilder () {
Original file line number Diff line number Diff line change 17
17
package com .google .cloud .datastore ;
18
18
19
19
import static org .junit .Assert .assertEquals ;
20
+ import static org .junit .Assert .assertNotEquals ;
20
21
import static org .junit .Assert .assertNotNull ;
21
22
import static org .junit .Assert .assertSame ;
22
23
import static org .junit .Assert .assertTrue ;
@@ -38,7 +39,6 @@ public class DatastoreOptionsTest {
38
39
private DatastoreRpc datastoreRpc ;
39
40
private DatastoreOptions .Builder options ;
40
41
41
- // todo parameterize
42
42
@ Before
43
43
public void setUp () {
44
44
datastoreRpcFactory = EasyMock .createMock (DatastoreRpcFactory .class );
@@ -90,6 +90,12 @@ public void testToBuilder() {
90
90
assertEquals (original .getHost (), copy .getHost ());
91
91
assertEquals (original .getRetrySettings (), copy .getRetrySettings ());
92
92
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 ());
93
99
}
94
100
95
101
@ Test
You can’t perform that action at this time.
0 commit comments