Class MockHttpTransport.Builder
- java.lang.Object
-
- com.google.api.client.testing.http.MockHttpTransport.Builder
-
- Enclosing class:
- MockHttpTransport
@Beta public static class MockHttpTransport.Builder extends Object
- Since:
- 1.5
-
-
Constructor Summary
Constructors Constructor Description Builder()
Constructs a newMockHttpTransport.Builder
.
-
Method Summary
-
-
-
Constructor Detail
-
Builder
public Builder()
Constructs a newMockHttpTransport.Builder
. Note that this constructor wasprotected
in version 1.17 and its predecessors, and was madepublic
in version 1.18.
-
-
Method Detail
-
build
public MockHttpTransport build()
Builds a new instance ofMockHttpTransport
.
-
getSupportedMethods
public final Set<String> getSupportedMethods()
Returns the supported HTTP methods ornull
to specify that all methods are supported.
-
setSupportedMethods
public final MockHttpTransport.Builder setSupportedMethods(Set<String> supportedMethods)
Sets the supported HTTP methods ornull
to specify that all methods are supported.
-
setLowLevelHttpRequest
public final MockHttpTransport.Builder setLowLevelHttpRequest(MockLowLevelHttpRequest lowLevelHttpRequest)
Sets theMockLowLevelHttpRequest
that will be returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String)
, if non-null
. Ifnull
,MockHttpTransport.buildRequest(java.lang.String, java.lang.String)
will create a newMockLowLevelHttpRequest
arguments.Note that the user can set a low level HTTP Request only if a low level HTTP response has not been set on this instance.
- Since:
- 1.18
-
getLowLevelHttpRequest
public final MockLowLevelHttpRequest getLowLevelHttpRequest()
Returns theMockLowLevelHttpRequest
that is associated with thisMockHttpTransport.Builder
, ornull
if no such instance exists.- Since:
- 1.18
-
setLowLevelHttpResponse
public final MockHttpTransport.Builder setLowLevelHttpResponse(MockLowLevelHttpResponse lowLevelHttpResponse)
Sets theMockLowLevelHttpResponse
that will be the result when theMockLowLevelHttpRequest
returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String)
is executed. Note that the response can be set only the caller has not provided aMockLowLevelHttpRequest
viasetLowLevelHttpRequest(com.google.api.client.testing.http.MockLowLevelHttpRequest)
.- Throws:
IllegalStateException
- if the caller has already set aLowLevelHttpRequest
in this instance- Since:
- 1.18
-
-