Class MockGoogleCredential.Builder (2.5.1)

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
Type Description
MockGoogleCredential
Overrides

setClientAuthentication(HttpExecuteInterceptor clientAuthentication)

public MockGoogleCredential.Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication)
Parameter
Name Description
clientAuthentication com.google.api.client.http.HttpExecuteInterceptor
Returns
Type Description
MockGoogleCredential.Builder
Overrides

setClock(Clock clock)

public MockGoogleCredential.Builder setClock(Clock clock)
Parameter
Name Description
clock com.google.api.client.util.Clock
Returns
Type Description
MockGoogleCredential.Builder
Overrides

setJsonFactory(JsonFactory jsonFactory)

public MockGoogleCredential.Builder setJsonFactory(JsonFactory jsonFactory)
Parameter
Name Description
jsonFactory com.google.api.client.json.JsonFactory
Returns
Type Description
MockGoogleCredential.Builder
Overrides

setTransport(HttpTransport transport)

public MockGoogleCredential.Builder setTransport(HttpTransport transport)
Parameter
Name Description
transport com.google.api.client.http.HttpTransport
Returns
Type Description
MockGoogleCredential.Builder
Overrides