Class MockGoogleCredential.Builder (2.0.0)

public static class MockGoogleCredential.Builder extends GoogleCredential.Builder

Mock for GoogleCredential.Builder.

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.

Inheritance

java.lang.Object > com.google.api.client.auth.oauth2.Credential.Builder > GoogleCredential.Builder > MockGoogleCredential.Builder

Constructors

Builder()

public Builder()

Methods

build()

public MockGoogleCredential build()
Returns
TypeDescription
MockGoogleCredential
Overrides

setClientAuthentication(HttpExecuteInterceptor clientAuthentication)

public MockGoogleCredential.Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication)
Parameter
NameDescription
clientAuthenticationcom.google.api.client.http.HttpExecuteInterceptor
Returns
TypeDescription
MockGoogleCredential.Builder
Overrides

setClock(Clock clock)

public MockGoogleCredential.Builder setClock(Clock clock)
Parameter
NameDescription
clockcom.google.api.client.util.Clock
Returns
TypeDescription
MockGoogleCredential.Builder
Overrides

setJsonFactory(JsonFactory jsonFactory)

public MockGoogleCredential.Builder setJsonFactory(JsonFactory jsonFactory)
Parameter
NameDescription
jsonFactorycom.google.api.client.json.JsonFactory
Returns
TypeDescription
MockGoogleCredential.Builder
Overrides

setTransport(HttpTransport transport)

public MockGoogleCredential.Builder setTransport(HttpTransport transport)
Parameter
NameDescription
transportcom.google.api.client.http.HttpTransport
Returns
TypeDescription
MockGoogleCredential.Builder
Overrides