@Beta public static class MockHttpTransport.Builder extends java.lang.Object
Constructor and Description |
---|
MockHttpTransport.Builder()
Constructs a new
MockHttpTransport.Builder . |
Modifier and Type | Method and Description |
---|---|
MockHttpTransport |
build()
Builds a new instance of
MockHttpTransport . |
MockLowLevelHttpRequest |
getLowLevelHttpRequest()
Returns the
MockLowLevelHttpRequest that is associated with this MockHttpTransport.Builder ,
or null if no such instance exists. |
java.util.Set<java.lang.String> |
getSupportedMethods()
Returns the supported HTTP methods or
null to specify that all methods are supported. |
MockHttpTransport.Builder |
setLowLevelHttpRequest(MockLowLevelHttpRequest lowLevelHttpRequest)
Sets the
MockLowLevelHttpRequest that will be returned by MockHttpTransport.buildRequest(java.lang.String, java.lang.String) , if
non-null . |
MockHttpTransport.Builder |
setLowLevelHttpResponse(MockLowLevelHttpResponse lowLevelHttpResponse)
Sets the
MockLowLevelHttpResponse that will be the result when the
MockLowLevelHttpRequest returned by MockHttpTransport.buildRequest(java.lang.String, java.lang.String) is executed. |
MockHttpTransport.Builder |
setSupportedMethods(java.util.Set<java.lang.String> supportedMethods)
Sets the supported HTTP methods or
null to specify that all methods are supported. |
public MockHttpTransport.Builder()
MockHttpTransport.Builder
. Note that this constructor was protected
in version 1.17 and its predecessors, and was made public
in version
1.18.public MockHttpTransport build()
MockHttpTransport
.public final java.util.Set<java.lang.String> getSupportedMethods()
null
to specify that all methods are supported.public final MockHttpTransport.Builder setSupportedMethods(java.util.Set<java.lang.String> supportedMethods)
null
to specify that all methods are supported.public final MockHttpTransport.Builder setLowLevelHttpRequest(MockLowLevelHttpRequest lowLevelHttpRequest)
MockLowLevelHttpRequest
that will be returned by MockHttpTransport.buildRequest(java.lang.String, java.lang.String)
, if
non-null
. If null
, MockHttpTransport.buildRequest(java.lang.String, java.lang.String)
will create a new
MockLowLevelHttpRequest
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.
public final MockLowLevelHttpRequest getLowLevelHttpRequest()
MockLowLevelHttpRequest
that is associated with this MockHttpTransport.Builder
,
or null
if no such instance exists.public final MockHttpTransport.Builder setLowLevelHttpResponse(MockLowLevelHttpResponse lowLevelHttpResponse)
MockLowLevelHttpResponse
that will be the result when the
MockLowLevelHttpRequest
returned by MockHttpTransport.buildRequest(java.lang.String, java.lang.String)
is executed.
Note that the response can be set only the caller has not provided a
MockLowLevelHttpRequest
via setLowLevelHttpRequest(com.google.api.client.testing.http.MockLowLevelHttpRequest)
.java.lang.IllegalStateException
- if the caller has already set a LowLevelHttpRequest
in this instanceCopyright © 2011-2018 Google. All Rights Reserved.