# Class MockDatastoreFactory (3.1.0)

3.1.0 (latest) 2.40.0 2.37.0 2.36.0 2.34.0 2.33.3 2.32.3 2.31.4 2.30.0 2.29.1 2.28.2 2.27.1 2.26.4 2.25.2 2.24.3 2.23.0 2.22.0 2.21.3 2.20.2 2.19.2 2.18.5 2.17.6

    public class MockDatastoreFactory extends DatastoreFactory

Fake Datastore factory used for testing purposes when a true Datastore service is not needed.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> [DatastoreFactory](https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory) \> MockDatastoreFactory

## Inherited Members

[DatastoreFactory.create(DatastoreOptions)](https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_create_com_google_datastore_utils_DatastoreOptions_) [DatastoreFactory.get()](https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_get__) [DatastoreFactory.logMethodCalls()](https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_logMethodCalls__) [DatastoreFactory.makeClient(DatastoreOptions)](https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_makeClient_com_google_datastore_utils_DatastoreOptions_) [DatastoreFactory.newRemoteRpc(DatastoreOptions)](https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_newRemoteRpc_com_google_datastore_utils_DatastoreOptions_) [Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### MockDatastoreFactory()

    public MockDatastoreFactory()

## Methods

### getLastApiFormatHeaderValue()

    public String getLastApiFormatHeaderValue()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getLastBody()

    public byte[] getLastBody()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `byte[]` |   |

### getLastCookies()

    public List<String> getLastCookies()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

### getLastMimeType()

    public String getLastMimeType()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getLastPath()

    public String getLastPath()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### makeClient(DatastoreOptions options)

    public HttpRequestFactory makeClient(DatastoreOptions options)

Constructs a Google APIs HTTP client with the associated credentials.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `options` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreOptions` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.http.HttpRequestFactory` |   |

**Overrides** [DatastoreFactory.makeClient(DatastoreOptions options)](https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_makeClient_com_google_datastore_utils_DatastoreOptions_)

### setNextError(int status, Code code, String message)

    public void setNextError(int status, Code code, String message)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `status` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `code` | `com.google.rpc.Code` |
| `message` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

### setNextException(IOException exception)

    public void setNextException(IOException exception)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `exception` | `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |

### setNextResponse(Message response)

    public void setNextResponse(Message response)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `response` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Message.html` |