Connections { public static InstrumentedDatastore createDatastore(Config config, Stats stats) { final String projectId = config.getString(DATASTORE_PROJECT); final String namespace = config.getString(DATASTORE_NAMESPACE); LOG.info("Creating Datastore connection for project:{}, namespace:{}", projectId, namespace); final Datastore datastore = DatastoreOptions.newBuilder() .setNamespace(namespace) .setProjectId(projectId) .build() .getService(); return InstrumentedDatastore.of(datastore, stats); } private  Connections(); static InstrumentedDatastore createDatastore(Config config, Stats stats); static Connection createBigTableConnection(Config config);  }
@Test public void createDatastore() { when(config.getString(Connections.DATASTORE_PROJECT)).thenReturn(TEST_PROJECT); when(config.getString(Connections.DATASTORE_NAMESPACE)).thenReturn(TEST_NAMESPACE); final InstrumentedDatastore instrumentedDatastore = Connections.createDatastore(config, stats); final Datastore datastore = instrumentedDatastore.delegate(); final DatastoreOptions options = datastore.getOptions(); assertThat(options.getProjectId(), is(TEST_PROJECT)); assertThat(options.getNamespace(), is(TEST_NAMESPACE)); }