Setters that are necessary for simple GoogleCredential creation are overridden in
order to change the return type. A concrete JsonFactory is set by default, since JSON
parsing is relied upon often in GoogleCredential which makes mocking parse calls problematic.
By default, a standard MockHttpTransport is supplied. For simple tests in which
'refresh' methods are called but the request/response isn't used #newMockHttpTransportWithSampleTokenResponse() provides a minimal implementation. For more
complex tests which check request/response behavior prefer MockTokenServerTransport.
[[["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-08-28 UTC."],[],[],null,["# Package com.google.api.client.googleapis.testing.auth.oauth2 (2.8.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.8.1 (latest)](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.testing.auth.oauth2)\n- [2.8.0](/java/docs/reference/google-api-client/2.8.0/com.google.api.client.googleapis.testing.auth.oauth2)\n- [2.7.2](/java/docs/reference/google-api-client/2.7.2/com.google.api.client.googleapis.testing.auth.oauth2)\n- [2.6.0](/java/docs/reference/google-api-client/2.6.0/com.google.api.client.googleapis.testing.auth.oauth2)\n- [2.5.1](/java/docs/reference/google-api-client/2.5.1/com.google.api.client.googleapis.testing.auth.oauth2)\n- [2.4.1](/java/docs/reference/google-api-client/2.4.1/com.google.api.client.googleapis.testing.auth.oauth2)\n- [2.1.2](/java/docs/reference/google-api-client/2.1.2/com.google.api.client.googleapis.testing.auth.oauth2)\n- [2.0.1](/java/docs/reference/google-api-client/2.0.1/com.google.api.client.googleapis.testing.auth.oauth2)\n- [1.35.2](/java/docs/reference/google-api-client/1.35.2/com.google.api.client.googleapis.testing.auth.oauth2)\n- [1.34.1](/java/docs/reference/google-api-client/1.34.1/com.google.api.client.googleapis.testing.auth.oauth2)\n- [1.33.4](/java/docs/reference/google-api-client/1.33.4/com.google.api.client.googleapis.testing.auth.oauth2) \n[com.google.api.client.util.Beta](https://cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.Beta.html) \n\nTest utilities for the `com.google.api.client.googleapis.auth.oauth2` package.\n\nClasses\n-------\n\n### [MockGoogleCredential](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.testing.auth.oauth2.MockGoogleCredential)\n\nBeta \n\nMock for [GoogleCredential](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleCredential).\n\n### [MockGoogleCredential.Builder](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.testing.auth.oauth2.MockGoogleCredential.Builder)\n\nMock for GoogleCredential.Builder.\n\nSetters that are necessary for simple [GoogleCredential](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleCredential) creation are overridden in\norder to change the return type. A concrete JsonFactory is set by default, since JSON\nparsing is relied upon often in GoogleCredential which makes mocking parse calls problematic.\n\nBy default, a standard MockHttpTransport is supplied. For simple tests in which\n'refresh' methods are called but the request/response isn't used #newMockHttpTransportWithSampleTokenResponse() provides a minimal implementation. For more\ncomplex tests which check request/response behavior prefer MockTokenServerTransport.\n\n### [MockTokenServerTransport](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.testing.auth.oauth2.MockTokenServerTransport)\n\nBeta \n\nA test transport that simulates Google's token server for refresh tokens and service accounts."]]