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) MockLowLevelHttpRequestTheMockLowLevelHttpRequestto be returned byMockHttpTransport.buildRequest(String, String).(package private) MockLowLevelHttpResponseTheMockLowLevelHttpResponsethat should be the result of theMockLowLevelHttpRequestto be returned byMockHttpTransport.buildRequest(String, String).Supported HTTP methods ornullto specify that all methods are supported. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a new instance ofMockHttpTransport.final MockLowLevelHttpRequestReturns theMockLowLevelHttpRequestthat is associated with thisMockHttpTransport.Builder, ornullif no such instance exists.(package private) MockLowLevelHttpResponseReturns theMockLowLevelHttpResponsethat is associated with thisMockHttpTransport.Builder, ornullif no such instance exists.Returns the supported HTTP methods ornullto specify that all methods are supported.setLowLevelHttpRequest(MockLowLevelHttpRequest lowLevelHttpRequest) Sets theMockLowLevelHttpRequestthat will be returned byMockHttpTransport.buildRequest(String, String), if non-null.setLowLevelHttpResponse(MockLowLevelHttpResponse lowLevelHttpResponse) Sets theMockLowLevelHttpResponsethat will be the result when theMockLowLevelHttpRequestreturned byMockHttpTransport.buildRequest(String, String)is executed.setSupportedMethods(Set<String> supportedMethods) Sets the supported HTTP methods ornullto specify that all methods are supported.
-
Field Details
-
supportedMethods
-
lowLevelHttpRequest
MockLowLevelHttpRequest lowLevelHttpRequestTheMockLowLevelHttpRequestto be returned byMockHttpTransport.buildRequest(String, String). If this field isnull,MockHttpTransport.buildRequest(String, String)will create a new instance from its arguments. -
lowLevelHttpResponse
MockLowLevelHttpResponse lowLevelHttpResponseTheMockLowLevelHttpResponsethat should be the result of theMockLowLevelHttpRequestto be returned byMockHttpTransport.buildRequest(String, String). Note that this field is ignored if the caller provides aMockLowLevelHttpRequestviasetLowLevelHttpRequest(MockLowLevelHttpRequest).
-
-
Constructor Details
-
Builder
public Builder()Constructs a newMockHttpTransport.Builder. Note that this constructor wasprotectedin version 1.17 and its predecessors, and was madepublicin version 1.18.
-
-
Method Details
-
build
Builds a new instance ofMockHttpTransport. -
getSupportedMethods
-
setSupportedMethods
Sets the supported HTTP methods ornullto specify that all methods are supported. -
setLowLevelHttpRequest
public final MockHttpTransport.Builder setLowLevelHttpRequest(MockLowLevelHttpRequest lowLevelHttpRequest) Sets theMockLowLevelHttpRequestthat will be returned byMockHttpTransport.buildRequest(String, String), if non-null. Ifnull,MockHttpTransport.buildRequest(String, String)will create a newMockLowLevelHttpRequestarguments.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 theMockLowLevelHttpRequestthat is associated with thisMockHttpTransport.Builder, ornullif no such instance exists.- Since:
- 1.18
-
setLowLevelHttpResponse
public final MockHttpTransport.Builder setLowLevelHttpResponse(MockLowLevelHttpResponse lowLevelHttpResponse) Sets theMockLowLevelHttpResponsethat will be the result when theMockLowLevelHttpRequestreturned byMockHttpTransport.buildRequest(String, String)is executed. Note that the response can be set only the caller has not provided aMockLowLevelHttpRequestviasetLowLevelHttpRequest(MockLowLevelHttpRequest).- Throws:
IllegalStateException- if the caller has already set aLowLevelHttpRequestin this instance- Since:
- 1.18
-
getLowLevelHttpResponse
MockLowLevelHttpResponse getLowLevelHttpResponse()Returns theMockLowLevelHttpResponsethat is associated with thisMockHttpTransport.Builder, ornullif no such instance exists.- Since:
- 1.18
-