Repository: googleapis/java-datastore
Pull request #49 (2020-02-18 19:58:51)

chore: release 1.101.3
:robot: I have created a release \*beep\* \*boop\* 
---
### [1.101.3](https://www.github.com/googleapis/java-datastore/compare/v1.101.2...v1.101.3) (2020-02-28)


### Bug Fixes

* flakey ITDatastoreTest#testSkippedResults ([#46](https://www.github.com/googleapis/java-datastore/issues/46)) ([3035ef2](https://www.github.com/googleapis/java-datastore/commit/3035ef2b6bf659bc847c4cf0a963a1f3badd68c7)), closes [#18](https://www.github.com/googleapis/java-datastore/issues/18)


### Dependencies

* update core dependencies ([#57](https://www.github.com/googleapis/java-datastore/issues/57)) ([34e94b1](https://www.github.com/googleapis/java-datastore/commit/34e94b15c670aea011503e8b6835301959ac0152))
* update core transport dependencies to v1.34.2 ([#44](https://www.github.com/googleapis/java-datastore/issues/44)) ([42e7e63](https://www.github.com/googleapis/java-datastore/commit/42e7e6349ac9a6ae9134f2bd1149a50f498a917e))
* update dependency com.google.protobuf:protobuf-java to v3.11.4 ([#48](https://www.github.com/googleapis/java-datastore/issues/48)) ([f78d0bd](https://www.github.com/googleapis/java-datastore/commit/f78d0bda15cce4e9639c582beab45a58d19d2a38))
* update dependency io.grpc:grpc-bom to v1.27.1 ([#45](https://www.github.com/googleapis/java-datastore/issues/45)) ([ef6ca5b](https://www.github.com/googleapis/java-datastore/commit/ef6ca5bb0dc7311253980d5bbef2d88a510d85cc))
* update dependency io.grpc:grpc-bom to v1.27.2 ([#55](https://www.github.com/googleapis/java-datastore/issues/55)) ([dea7ec2](https://www.github.com/googleapis/java-datastore/commit/dea7ec20c603be9890f06a78fa17396299232a20))
* update truth 1.0 -> 1.0.1 ([#58](https://www.github.com/googleapis/java-datastore/issues/58)) ([2af29c5](https://www.github.com/googleapis/java-datastore/commit/2af29c5c5fb13921f79e6b8b68fff0c82be29402))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).

codecov[bot]: # [Codecov](https://codecov.io/gh/googleapis/java-datastore/pull/49?src=pr&el=h1) Report
> Merging [#49](https://codecov.io/gh/googleapis/java-datastore/pull/49?src=pr&el=desc) into [master](https://codecov.io/gh/googleapis/java-datastore/commit/69860c82d1582c7fb359b74f3f8bbea1aaf727df?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/googleapis/java-datastore/pull/49/graphs/tree.svg?width=650&token=bmHCjjS4wo&height=150&src=pr)](https://codecov.io/gh/googleapis/java-datastore/pull/49?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##             master      #49   +/-   ##
=========================================
  Coverage     59.72%   59.72%           
  Complexity      378      378           
=========================================
  Files            46       46           
  Lines          2262     2262           
  Branches        247      247           
=========================================
  Hits           1351     1351           
  Misses          804      804           
  Partials        107      107
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/googleapis/java-datastore/pull/49?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/googleapis/java-datastore/pull/49?src=pr&el=footer). Last update [69860c8...2e3e05c](https://codecov.io/gh/googleapis/java-datastore/pull/49?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 563cf22a..865df6c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,22 @@
 # Changelog
 
+### [1.101.3](https://www.github.com/googleapis/java-datastore/compare/v1.101.2...v1.101.3) (2020-02-28)
+
+
+### Bug Fixes
+
+* flakey ITDatastoreTest#testSkippedResults ([#46](https://www.github.com/googleapis/java-datastore/issues/46)) ([3035ef2](https://www.github.com/googleapis/java-datastore/commit/3035ef2b6bf659bc847c4cf0a963a1f3badd68c7)), closes [#18](https://www.github.com/googleapis/java-datastore/issues/18)
+
+
+### Dependencies
+
+* update core dependencies ([#57](https://www.github.com/googleapis/java-datastore/issues/57)) ([34e94b1](https://www.github.com/googleapis/java-datastore/commit/34e94b15c670aea011503e8b6835301959ac0152))
+* update core transport dependencies to v1.34.2 ([#44](https://www.github.com/googleapis/java-datastore/issues/44)) ([42e7e63](https://www.github.com/googleapis/java-datastore/commit/42e7e6349ac9a6ae9134f2bd1149a50f498a917e))
+* update dependency com.google.protobuf:protobuf-java to v3.11.4 ([#48](https://www.github.com/googleapis/java-datastore/issues/48)) ([f78d0bd](https://www.github.com/googleapis/java-datastore/commit/f78d0bda15cce4e9639c582beab45a58d19d2a38))
+* update dependency io.grpc:grpc-bom to v1.27.1 ([#45](https://www.github.com/googleapis/java-datastore/issues/45)) ([ef6ca5b](https://www.github.com/googleapis/java-datastore/commit/ef6ca5bb0dc7311253980d5bbef2d88a510d85cc))
+* update dependency io.grpc:grpc-bom to v1.27.2 ([#55](https://www.github.com/googleapis/java-datastore/issues/55)) ([dea7ec2](https://www.github.com/googleapis/java-datastore/commit/dea7ec20c603be9890f06a78fa17396299232a20))
+* update truth 1.0 -> 1.0.1 ([#58](https://www.github.com/googleapis/java-datastore/issues/58)) ([2af29c5](https://www.github.com/googleapis/java-datastore/commit/2af29c5c5fb13921f79e6b8b68fff0c82be29402))
+
 ### [1.101.2](https://www.github.com/googleapis/java-datastore/compare/v1.101.1...v1.101.2) (2020-02-13)
 
 
diff --git a/README.md b/README.md
index b4720be4..5432e0da 100644
--- a/README.md
+++ b/README.md
@@ -37,16 +37,16 @@ If you are using Maven without a BOM, add this to your dependencies.
 <dependency>
   <groupId>com.google.cloud</groupId>
   <artifactId>google-cloud-datastore</artifactId>
-  <version>1.102.2</version>
+  <version>1.102.3</version>
 </dependency>
 ```
 If you are using Gradle, add this to your dependencies
 ```Groovy
-compile 'com.google.cloud:google-cloud-datastore:1.102.2'
+compile 'com.google.cloud:google-cloud-datastore:1.102.3'
 ```
 If you are using SBT, add this to your dependencies
 ```Scala
-libraryDependencies += "com.google.cloud" % "google-cloud-datastore" % "1.102.2"
+libraryDependencies += "com.google.cloud" % "google-cloud-datastore" % "1.102.3"
 ```
 [//]: # ({x-version-update-end})
 
diff --git a/google-cloud-datastore-bom/pom.xml b/google-cloud-datastore-bom/pom.xml
index d0d726e7..238f61a2 100644
--- a/google-cloud-datastore-bom/pom.xml
+++ b/google-cloud-datastore-bom/pom.xml
@@ -3,7 +3,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.google.cloud</groupId>
   <artifactId>google-cloud-datastore-bom</artifactId>
-  <version>1.102.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore-bom:current} -->
+  <version>1.102.3</version><!-- {x-version-update:google-cloud-datastore-bom:current} -->
   <packaging>pom</packaging>
   <parent>
     <groupId>com.google.cloud</groupId>
@@ -63,12 +63,12 @@
       <dependency>
         <groupId>com.google.api.grpc</groupId>
         <artifactId>proto-google-cloud-datastore-v1</artifactId>
-        <version>0.85.3-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
+        <version>0.85.3</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.cloud</groupId>
         <artifactId>google-cloud-datastore</artifactId>
-        <version>1.102.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
+        <version>1.102.3</version><!-- {x-version-update:google-cloud-datastore:current} -->
       </dependency>
     </dependencies>
   </dependencyManagement>
diff --git a/google-cloud-datastore/clirr-ignored-differences.xml b/google-cloud-datastore/clirr-ignored-differences.xml
new file mode 100644
index 00000000..110f22f7
--- /dev/null
+++ b/google-cloud-datastore/clirr-ignored-differences.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- see http://mojo.codehaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
+<differences>
+    <difference>
+        <className>com/google/cloud/datastore/Datastore</className>
+        <method>java.util.List reserveIds(com.google.cloud.datastore.Key[])</method>
+        <differenceType>7012</differenceType>
+    </difference>
+    <difference>
+        <className>com/google/cloud/datastore/spi/v1/DatastoreRpc</className>
+        <method>com.google.datastore.v1.ReserveIdsResponse reserveIds(com.google.datastore.v1.ReserveIdsRequest)</method>
+        <differenceType>7012</differenceType>
+    </difference>
+</differences>
diff --git a/google-cloud-datastore/pom.xml b/google-cloud-datastore/pom.xml
index 6e3f56d4..0f3873c8 100644
--- a/google-cloud-datastore/pom.xml
+++ b/google-cloud-datastore/pom.xml
@@ -2,7 +2,7 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <artifactId>google-cloud-datastore</artifactId>
-  <version>1.102.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
+  <version>1.102.3</version><!-- {x-version-update:google-cloud-datastore:current} -->
   <packaging>jar</packaging>
   <name>Google Cloud Datastore</name>
   <url>https://github.com/googleapis/java-datastore</url>
@@ -12,7 +12,7 @@
   <parent>
     <groupId>com.google.cloud</groupId>
     <artifactId>google-cloud-datastore-parent</artifactId>
-    <version>1.102.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore-parent:current} -->
+    <version>1.102.3</version><!-- {x-version-update:google-cloud-datastore-parent:current} -->
   </parent>
   <properties>
     <site.installationModule>google-cloud-datastore</site.installationModule>
diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Datastore.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Datastore.java
index 0edbadc1..bb115995 100644
--- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Datastore.java
+++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Datastore.java
@@ -168,6 +168,23 @@ public interface Datastore extends Service<DatastoreOptions>, DatastoreReaderWri
    */
   List<Key> allocateId(IncompleteKey... keys);
 
+  /**
+   * Reserve one or more keys, preventing them from being automatically allocated by Datastore.
+   *
+   * <p>Example of reserving multiple ids in a single batch.
+   *
+   * <pre>{@code
+   * KeyFactory keyFactory = datastore.newKeyFactory().setKind("MyKind");
+   * Key key1 = keyFactory.newKey(10);
+   * Key key2 = keyFactory.newKey("name");
+   * List<Key> keys = datastore.reserveIds(key1, key2);
+   *
+   * }</pre>
+   *
+   * @throws DatastoreException upon failure
+   */
+  List<Key> reserveIds(Key... keys);
+
   /**
    * {@inheritDoc}
    *
diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DatastoreImpl.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DatastoreImpl.java
index 84102c75..be31594e 100644
--- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DatastoreImpl.java
+++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DatastoreImpl.java
@@ -31,6 +31,7 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Sets;
 import com.google.datastore.v1.ReadOptions.ReadConsistency;
+import com.google.datastore.v1.ReserveIdsRequest;
 import com.google.datastore.v1.TransactionOptions;
 import com.google.protobuf.ByteString;
 import java.util.ArrayList;
@@ -400,6 +401,40 @@ final class DatastoreImpl extends BaseService<DatastoreOptions> implements Datas
     }
   }
 
+  @Override
+  public List<Key> reserveIds(Key... keys) {
+    ReserveIdsRequest.Builder requestPb = ReserveIdsRequest.newBuilder();
+    for (Key key : keys) {
+      requestPb.addKeys(key.toPb());
+    }
+    com.google.datastore.v1.ReserveIdsResponse responsePb = reserveIds(requestPb.build());
+    ImmutableList.Builder<Key> keyList = ImmutableList.builder();
+    if (responsePb.isInitialized()) {
+      for (Key key : keys) {
+        keyList.add(key);
+      }
+    }
+    return keyList.build();
+  }
+
+  com.google.datastore.v1.ReserveIdsResponse reserveIds(
+      final com.google.datastore.v1.ReserveIdsRequest requestPb) {
+    try {
+      return RetryHelper.runWithRetries(
+          new Callable<com.google.datastore.v1.ReserveIdsResponse>() {
+            @Override
+            public com.google.datastore.v1.ReserveIdsResponse call() throws DatastoreException {
+              return datastoreRpc.reserveIds(requestPb);
+            }
+          },
+          retrySettings,
+          EXCEPTION_HANDLER,
+          getOptions().getClock());
+    } catch (RetryHelperException e) {
+      throw DatastoreException.translateAndThrow(e);
+    }
+  }
+
   @Override
   public void update(Entity... entities) {
     if (entities.length > 0) {
diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/spi/v1/DatastoreRpc.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/spi/v1/DatastoreRpc.java
index d39f3a30..5e64c925 100644
--- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/spi/v1/DatastoreRpc.java
+++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/spi/v1/DatastoreRpc.java
@@ -26,6 +26,8 @@ import com.google.datastore.v1.CommitRequest;
 import com.google.datastore.v1.CommitResponse;
 import com.google.datastore.v1.LookupRequest;
 import com.google.datastore.v1.LookupResponse;
+import com.google.datastore.v1.ReserveIdsRequest;
+import com.google.datastore.v1.ReserveIdsResponse;
 import com.google.datastore.v1.RollbackRequest;
 import com.google.datastore.v1.RollbackResponse;
 import com.google.datastore.v1.RunQueryRequest;
@@ -63,6 +65,13 @@ public interface DatastoreRpc extends ServiceRpc {
    */
   LookupResponse lookup(LookupRequest request);
 
+  /**
+   * Sends a reserveIds request.
+   *
+   * @throws DatastoreException upon failure
+   */
+  ReserveIdsResponse reserveIds(ReserveIdsRequest request);
+
   /**
    * Sends a rollback request.
    *
diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/spi/v1/HttpDatastoreRpc.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/spi/v1/HttpDatastoreRpc.java
index 27ff8cec..7d343410 100644
--- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/spi/v1/HttpDatastoreRpc.java
+++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/spi/v1/HttpDatastoreRpc.java
@@ -30,6 +30,8 @@ import com.google.datastore.v1.CommitRequest;
 import com.google.datastore.v1.CommitResponse;
 import com.google.datastore.v1.LookupRequest;
 import com.google.datastore.v1.LookupResponse;
+import com.google.datastore.v1.ReserveIdsRequest;
+import com.google.datastore.v1.ReserveIdsResponse;
 import com.google.datastore.v1.RollbackRequest;
 import com.google.datastore.v1.RollbackResponse;
 import com.google.datastore.v1.RunQueryRequest;
@@ -164,6 +166,15 @@ public class HttpDatastoreRpc implements DatastoreRpc {
     }
   }
 
+  @Override
+  public ReserveIdsResponse reserveIds(ReserveIdsRequest request) {
+    try {
+      return client.reserveIds(request);
+    } catch (com.google.datastore.v1.client.DatastoreException ex) {
+      throw translate(ex);
+    }
+  }
+
   @Override
   public RollbackResponse rollback(RollbackRequest request) {
     try {
diff --git a/pom.xml b/pom.xml
index 793b3e8a..953a04c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
   <groupId>com.google.cloud</groupId>
   <artifactId>google-cloud-datastore-parent</artifactId>
   <packaging>pom</packaging>
-  <version>1.102.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore-parent:current} -->
+  <version>1.102.3</version><!-- {x-version-update:google-cloud-datastore-parent:current} -->
   <name>Google Cloud Datastore Parent</name>
   <url>https://github.com/googleapis/java-datastore</url>
   <description>
@@ -152,7 +152,7 @@
     <github.global.server>github</github.global.server>
     <site.installationModule>google-cloud-datastore-parent</site.installationModule>
     <project.javadoc.protobufBaseURL>https://googleapis.dev/java/google-api-grpc/latest</project.javadoc.protobufBaseURL>
-    <google.core.version>1.93.0</google.core.version>
+    <google.core.version>1.93.1</google.core.version>
     <google.api-common.version>1.8.1</google.api-common.version>
     <google.common-protos.version>1.17.0</google.common-protos.version>
     <gax.version>1.54.0</gax.version>
@@ -172,7 +172,7 @@
       <dependency>
         <groupId>com.google.api.grpc</groupId>
         <artifactId>proto-google-cloud-datastore-v1</artifactId>
-        <version>0.85.3-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
+        <version>0.85.3</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
       </dependency>
 
       <dependency>
diff --git a/proto-google-cloud-datastore-v1/pom.xml b/proto-google-cloud-datastore-v1/pom.xml
index 16fdbfdd..cb93fc72 100644
--- a/proto-google-cloud-datastore-v1/pom.xml
+++ b/proto-google-cloud-datastore-v1/pom.xml
@@ -4,13 +4,13 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.google.api.grpc</groupId>
   <artifactId>proto-google-cloud-datastore-v1</artifactId>
-  <version>0.85.3-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
+  <version>0.85.3</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
   <name>proto-google-cloud-datastore-v1</name>
   <description>PROTO library for proto-google-cloud-datastore-v1</description>
   <parent>
     <groupId>com.google.cloud</groupId>
     <artifactId>google-cloud-datastore-parent</artifactId>
-    <version>1.102.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore-parent:current} -->
+    <version>1.102.3</version><!-- {x-version-update:google-cloud-datastore-parent:current} -->
   </parent>
   <dependencies>
     <dependency>
diff --git a/versions.txt b/versions.txt
index be22dd92..a5e446db 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,8 +1,8 @@
 # Format:
 # module:released-version:current-version
 
-google-cloud-datastore:1.102.2:1.102.3-SNAPSHOT
-google-cloud-datastore-bom:1.102.2:1.102.3-SNAPSHOT
-google-cloud-datastore-parent:1.102.2:1.102.3-SNAPSHOT
-proto-google-cloud-datastore-v1:0.85.2:0.85.3-SNAPSHOT
+google-cloud-datastore:1.102.3:1.102.3
+google-cloud-datastore-bom:1.102.3:1.102.3
+google-cloud-datastore-parent:1.102.3:1.102.3
+proto-google-cloud-datastore-v1:0.85.3:0.85.3
 


Test patch:
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ITDatastoreTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ITDatastoreTest.java
index bef15e40..8049e095 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ITDatastoreTest.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ITDatastoreTest.java
@@ -16,6 +16,9 @@
 
 package com.google.cloud.datastore;
 
+import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
@@ -47,6 +50,8 @@ import com.google.datastore.v1.PartitionId;
 import com.google.datastore.v1.QueryResultBatch;
 import com.google.datastore.v1.ReadOptions;
 import com.google.datastore.v1.ReadOptions.ReadConsistency;
+import com.google.datastore.v1.ReserveIdsRequest;
+import com.google.datastore.v1.ReserveIdsResponse;
 import com.google.datastore.v1.RollbackRequest;
 import com.google.datastore.v1.RollbackResponse;
 import com.google.datastore.v1.RunQueryRequest;
@@ -55,6 +60,7 @@ import com.google.datastore.v1.TransactionOptions;
 import com.google.protobuf.ByteString;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -840,6 +846,30 @@ public class ITDatastoreTest {
     }
   }
 
+  @Test
+  public void testReserveIds() {
+    ReserveIdsRequest reserveIdsRequest =
+        ReserveIdsRequest.newBuilder().addKeys(KEY1.toPb()).build();
+    EasyMock.expect(rpcMock.reserveIds(reserveIdsRequest))
+        .andReturn(ReserveIdsResponse.newBuilder().build())
+        .times(1);
+    EasyMock.replay(rpcFactoryMock, rpcMock);
+    Datastore datastore = rpcMockOptions.getService();
+    datastore.reserveIds(KEY1);
+    EasyMock.verify(rpcFactoryMock, rpcMock);
+  }
+
+  @Test
+  public void testReserveIdsWithKeys() {
+    Datastore datastore = createStrictMock(Datastore.class);
+    EasyMock.expect(datastore.reserveIds(KEY1, KEY2)).andReturn(Arrays.asList(KEY1, KEY2));
+    replay(datastore);
+    List<Key> result = datastore.reserveIds(KEY1, KEY2);
+    assertEquals(KEY1, result.get(0));
+    assertEquals(KEY2, result.get(1));
+    verify(datastore);
+  }
+
   @Test
   public void testGet() {
     Entity entity = datastore.get(KEY3);
diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTest.java
index af1848ad..798b37e0 100644
--- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTest.java
+++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTest.java
@@ -597,6 +597,15 @@ public class ITDatastoreTest {
     assertEquals(Key.newBuilder(pk1, key2.getId()).build(), key2);
   }
 
+  @Test
+  public void testReserveIds() {
+    KeyFactory keyFactory = DATASTORE.newKeyFactory().setKind("MyKind");
+    Key key1 = keyFactory.newKey(10);
+    Key key2 = keyFactory.newKey("name");
+    List<Key> keyList = DATASTORE.reserveIds(key1, key2);
+    assertEquals(2, keyList.size());
+  }
+
   @Test
   public void testAllocateIdArray() {
     KeyFactory keyFactory = DATASTORE.newKeyFactory().setKind(KIND1);