Class MockHttpTransport.Builder
java.lang.Object
com.google.api.client.testing.http.MockHttpTransport.Builder
- Enclosing class:
MockHttpTransport
- Since:
- 1.5
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) MockLowLevelHttpRequest
TheMockLowLevelHttpRequest
to be returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String)
.(package private) MockLowLevelHttpResponse
TheMockLowLevelHttpResponse
that should be the result of theMockLowLevelHttpRequest
to be returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String)
.Supported HTTP methods ornull
to specify that all methods are supported. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a new instance ofMockHttpTransport
.final MockLowLevelHttpRequest
Returns theMockLowLevelHttpRequest
that is associated with thisMockHttpTransport.Builder
, ornull
if no such instance exists.(package private) MockLowLevelHttpResponse
Returns theMockLowLevelHttpResponse
that is associated with thisMockHttpTransport.Builder
, ornull
if no such instance exists.Returns the supported HTTP methods ornull
to specify that all methods are supported.setLowLevelHttpRequest
(MockLowLevelHttpRequest lowLevelHttpRequest) Sets theMockLowLevelHttpRequest
that will be returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String)
, if non-null
.setLowLevelHttpResponse
(MockLowLevelHttpResponse lowLevelHttpResponse) Sets theMockLowLevelHttpResponse
that will be the result when theMockLowLevelHttpRequest
returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String)
is executed.setSupportedMethods
(Set<String> supportedMethods) Sets the supported HTTP methods ornull
to specify that all methods are supported.
-
Field Details
-
supportedMethods
Supported HTTP methods ornull
to specify that all methods are supported. -
lowLevelHttpRequest
MockLowLevelHttpRequest lowLevelHttpRequestTheMockLowLevelHttpRequest
to be returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String)
. If this field isnull
,MockHttpTransport.buildRequest(java.lang.String, java.lang.String)
will create a new instance from its arguments. -
lowLevelHttpResponse
MockLowLevelHttpResponse lowLevelHttpResponseTheMockLowLevelHttpResponse
that should be the result of theMockLowLevelHttpRequest
to be returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String)
. Note that this field is ignored if the caller provides aMockLowLevelHttpRequest
viasetLowLevelHttpRequest(com.google.api.client.testing.http.MockLowLevelHttpRequest)
.
-
-
Constructor Details
-
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 Details
-
build
Builds a new instance ofMockHttpTransport
. -
getSupportedMethods
Returns the supported HTTP methods ornull
to specify that all methods are supported. -
setSupportedMethods
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
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
-
getLowLevelHttpResponse
MockLowLevelHttpResponse getLowLevelHttpResponse()Returns theMockLowLevelHttpResponse
that is associated with thisMockHttpTransport.Builder
, ornull
if no such instance exists.- Since:
- 1.18
-