Class MockHttpTransport.Builder
- java.lang.Object
-
- com.google.api.client.testing.http.MockHttpTransport.Builder
-
- Enclosing class:
- MockHttpTransport
@Beta public static class MockHttpTransport.Builder extends java.lang.Object
- Since:
- 1.5
-
-
Field Summary
Fields Modifier and Type Field Description (package private) MockLowLevelHttpRequestlowLevelHttpRequestTheMockLowLevelHttpRequestto be returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String).(package private) MockLowLevelHttpResponselowLevelHttpResponseTheMockLowLevelHttpResponsethat should be the result of theMockLowLevelHttpRequestto be returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String).(package private) java.util.Set<java.lang.String>supportedMethodsSupported HTTP methods ornullto specify that all methods are supported.
-
Constructor Summary
Constructors Constructor Description Builder()Constructs a newMockHttpTransport.Builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MockHttpTransportbuild()Builds a new instance ofMockHttpTransport.MockLowLevelHttpRequestgetLowLevelHttpRequest()Returns theMockLowLevelHttpRequestthat is associated with thisMockHttpTransport.Builder, ornullif no such instance exists.(package private) MockLowLevelHttpResponsegetLowLevelHttpResponse()Returns theMockLowLevelHttpResponsethat is associated with thisMockHttpTransport.Builder, ornullif no such instance exists.java.util.Set<java.lang.String>getSupportedMethods()Returns the supported HTTP methods ornullto specify that all methods are supported.MockHttpTransport.BuildersetLowLevelHttpRequest(MockLowLevelHttpRequest lowLevelHttpRequest)Sets theMockLowLevelHttpRequestthat will be returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String), if non-null.MockHttpTransport.BuildersetLowLevelHttpResponse(MockLowLevelHttpResponse lowLevelHttpResponse)Sets theMockLowLevelHttpResponsethat will be the result when theMockLowLevelHttpRequestreturned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String)is executed.MockHttpTransport.BuildersetSupportedMethods(java.util.Set<java.lang.String> supportedMethods)Sets the supported HTTP methods ornullto specify that all methods are supported.
-
-
-
Field Detail
-
supportedMethods
java.util.Set<java.lang.String> supportedMethods
Supported HTTP methods ornullto specify that all methods are supported.
-
lowLevelHttpRequest
MockLowLevelHttpRequest lowLevelHttpRequest
TheMockLowLevelHttpRequestto 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 lowLevelHttpResponse
TheMockLowLevelHttpResponsethat should be the result of theMockLowLevelHttpRequestto be returned byMockHttpTransport.buildRequest(java.lang.String, java.lang.String). Note that this field is ignored if the caller provides aMockLowLevelHttpRequestviasetLowLevelHttpRequest(com.google.api.client.testing.http.MockLowLevelHttpRequest).
-
-
Constructor Detail
-
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 Detail
-
build
public MockHttpTransport build()
Builds a new instance ofMockHttpTransport.
-
getSupportedMethods
public final java.util.Set<java.lang.String> getSupportedMethods()
Returns the supported HTTP methods ornullto specify that all methods are supported.
-
setSupportedMethods
public final MockHttpTransport.Builder setSupportedMethods(java.util.Set<java.lang.String> supportedMethods)
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(java.lang.String, java.lang.String), if non-null. Ifnull,MockHttpTransport.buildRequest(java.lang.String, java.lang.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
public final MockLowLevelHttpRequest 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(java.lang.String, java.lang.String)is executed. Note that the response can be set only the caller has not provided aMockLowLevelHttpRequestviasetLowLevelHttpRequest(com.google.api.client.testing.http.MockLowLevelHttpRequest).- Throws:
java.lang.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
-
-