[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Class MockDatastoreFactory (2.31.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.31.2 (latest)](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.31.1](/java/docs/reference/google-cloud-datastore/2.31.1/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.30.0](/java/docs/reference/google-cloud-datastore/2.30.0/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.29.1](/java/docs/reference/google-cloud-datastore/2.29.1/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.28.2](/java/docs/reference/google-cloud-datastore/2.28.2/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.27.1](/java/docs/reference/google-cloud-datastore/2.27.1/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.26.4](/java/docs/reference/google-cloud-datastore/2.26.4/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.25.2](/java/docs/reference/google-cloud-datastore/2.25.2/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.24.3](/java/docs/reference/google-cloud-datastore/2.24.3/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.23.0](/java/docs/reference/google-cloud-datastore/2.23.0/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.22.0](/java/docs/reference/google-cloud-datastore/2.22.0/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.21.3](/java/docs/reference/google-cloud-datastore/2.21.3/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.20.2](/java/docs/reference/google-cloud-datastore/2.20.2/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.19.2](/java/docs/reference/google-cloud-datastore/2.19.2/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.18.5](/java/docs/reference/google-cloud-datastore/2.18.5/com.google.datastore.utils.testing.MockDatastoreFactory)\n- [2.17.6](/java/docs/reference/google-cloud-datastore/2.17.6/com.google.datastore.utils.testing.MockDatastoreFactory) \n\n public class MockDatastoreFactory extends DatastoreFactory\n\nFake Datastore factory used for testing purposes when a true Datastore service is not needed. \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e [DatastoreFactory](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory) \\\u003e MockDatastoreFactory \n\nInherited Members\n-----------------\n\n[DatastoreFactory.create(DatastoreOptions)](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_create_com_google_datastore_utils_DatastoreOptions_) \n[DatastoreFactory.get()](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_get__) \n[DatastoreFactory.logMethodCalls()](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_logMethodCalls__) \n[DatastoreFactory.makeClient(DatastoreOptions)](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_makeClient_com_google_datastore_utils_DatastoreOptions_) \n[DatastoreFactory.newRemoteRpc(DatastoreOptions)](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_newRemoteRpc_com_google_datastore_utils_DatastoreOptions_) \n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nConstructors\n------------\n\n### MockDatastoreFactory()\n\n public MockDatastoreFactory()\n\nMethods\n-------\n\n### getLastApiFormatHeaderValue()\n\n public String getLastApiFormatHeaderValue()\n\n### getLastBody()\n\n public byte[] getLastBody()\n\n### getLastCookies()\n\n public List\u003cString\u003e getLastCookies()\n\n### getLastMimeType()\n\n public String getLastMimeType()\n\n### getLastPath()\n\n public String getLastPath()\n\n### makeClient(DatastoreOptions options)\n\n public HttpRequestFactory makeClient(DatastoreOptions options)\n\nConstructs a Google APIs HTTP client with the associated credentials.\n\n**Overrides** \n[DatastoreFactory.makeClient(DatastoreOptions options)](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.utils.DatastoreFactory#com_google_datastore_utils_DatastoreFactory_makeClient_com_google_datastore_utils_DatastoreOptions_)\n\n### setNextError(int status, Code code, String message)\n\n public void setNextError(int status, Code code, String message)\n\n### setNextException(IOException exception)\n\n public void setNextException(IOException exception)\n\n### setNextResponse(Message response)\n\n public void setNextResponse(Message response)"]]