@Beta public static class MockGoogleCredential.Builder extends 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
MockGoogleCredential.newMockHttpTransportWithSampleTokenResponse()
provides a minimal implementation. For
more complex tests which check request/response behavior prefer MockTokenServerTransport.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
MockGoogleCredential |
build() |
MockGoogleCredential.Builder |
setClientAuthentication(com.google.api.client.http.HttpExecuteInterceptor clientAuthentication) |
MockGoogleCredential.Builder |
setClock(com.google.api.client.util.Clock clock) |
MockGoogleCredential.Builder |
setJsonFactory(com.google.api.client.json.JsonFactory jsonFactory) |
MockGoogleCredential.Builder |
setTransport(com.google.api.client.http.HttpTransport transport) |
addRefreshListener, getServiceAccountId, getServiceAccountPrivateKey, getServiceAccountPrivateKeyId, getServiceAccountProjectId, getServiceAccountScopes, getServiceAccountUser, setClientSecrets, setClientSecrets, setRefreshListeners, setRequestInitializer, setServiceAccountId, setServiceAccountPrivateKey, setServiceAccountPrivateKeyFromP12File, setServiceAccountPrivateKeyFromP12File, setServiceAccountPrivateKeyFromPemFile, setServiceAccountPrivateKeyId, setServiceAccountProjectId, setServiceAccountScopes, setServiceAccountUser, setTokenServerEncodedUrl, setTokenServerUrl
public MockGoogleCredential.Builder setTransport(com.google.api.client.http.HttpTransport transport)
setTransport
in class GoogleCredential.Builder
public MockGoogleCredential.Builder setClientAuthentication(com.google.api.client.http.HttpExecuteInterceptor clientAuthentication)
setClientAuthentication
in class GoogleCredential.Builder
public MockGoogleCredential.Builder setJsonFactory(com.google.api.client.json.JsonFactory jsonFactory)
setJsonFactory
in class GoogleCredential.Builder
public MockGoogleCredential.Builder setClock(com.google.api.client.util.Clock clock)
setClock
in class GoogleCredential.Builder
public MockGoogleCredential build()
build
in class GoogleCredential.Builder
Copyright © 2010–2019 Google. All rights reserved.