Open jacobg opened 5 years ago
Currently, DatastoreService is a singleton object that creates a private reference to Google's Datastore object. That means it can't be changed. But for testability, it would be great to replace it with a test version using LocalDatastoreHelper: https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java
DatastoreService
LocalDatastoreHelper
So probably, it would be a good idea to either make DatastoreService.cloudDataStore public, or better yet, make DatastoreService a class that can be instantiated with a caller-provided Datastore.
DatastoreService.cloudDataStore
Datastore
Currently,
DatastoreService
is a singleton object that creates a private reference to Google's Datastore object. That means it can't be changed. But for testability, it would be great to replace it with a test version usingLocalDatastoreHelper
: https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.javaSo probably, it would be a good idea to either make
DatastoreService.cloudDataStore
public, or better yet, makeDatastoreService
a class that can be instantiated with a caller-providedDatastore
.