@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(HttpExecuteInterceptor clientAuthentication) |
MockGoogleCredential.Builder |
setClock(Clock clock) |
MockGoogleCredential.Builder |
setJsonFactory(JsonFactory jsonFactory) |
MockGoogleCredential.Builder |
setTransport(HttpTransport transport) |
addRefreshListener, getServiceAccountId, getServiceAccountPrivateKey, getServiceAccountPrivateKeyId, getServiceAccountProjectId, getServiceAccountScopes, getServiceAccountUser, setClientSecrets, setClientSecrets, setRefreshListeners, setRequestInitializer, setServiceAccountId, setServiceAccountPrivateKey, setServiceAccountPrivateKeyFromP12File, setServiceAccountPrivateKeyFromP12File, setServiceAccountPrivateKeyFromPemFile, setServiceAccountPrivateKeyId, setServiceAccountProjectId, setServiceAccountScopes, setServiceAccountUser, setTokenServerEncodedUrl, setTokenServerUrl
getClientAuthentication, getClock, getJsonFactory, getMethod, getRefreshListeners, getRequestInitializer, getTokenServerUrl, getTransport
public MockGoogleCredential.Builder setTransport(HttpTransport transport)
setTransport
in class GoogleCredential.Builder
public MockGoogleCredential.Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication)
setClientAuthentication
in class GoogleCredential.Builder
public MockGoogleCredential.Builder setJsonFactory(JsonFactory jsonFactory)
setJsonFactory
in class GoogleCredential.Builder
public MockGoogleCredential.Builder setClock(Clock clock)
setClock
in class GoogleCredential.Builder
public MockGoogleCredential build()
build
in class GoogleCredential.Builder
Copyright © 2010–2019 Google. All rights reserved.