Class MockHttpTransport.Builder (1.43.0)

public static class MockHttpTransport.Builder

Beta
Builder for MockHttpTransport.

Implementation is not thread-safe.

Inheritance

java.lang.Object > MockHttpTransport.Builder

Constructors

Builder()

public Builder()

Constructs a new Builder. Note that this constructor was protected in version 1.17 and its predecessors, and was made public in version 1.18.

Methods

build()

public MockHttpTransport build()

Builds a new instance of MockHttpTransport.

Returns
TypeDescription
MockHttpTransport

getLowLevelHttpRequest()

public final MockLowLevelHttpRequest getLowLevelHttpRequest()

Returns the MockLowLevelHttpRequest that is associated with this Builder, or null if no such instance exists.

Returns
TypeDescription
MockLowLevelHttpRequest

getSupportedMethods()

public final Set<String> getSupportedMethods()

Returns the supported HTTP methods or null to specify that all methods are supported.

Returns
TypeDescription
Set<String>

setLowLevelHttpRequest(MockLowLevelHttpRequest lowLevelHttpRequest)

public final MockHttpTransport.Builder setLowLevelHttpRequest(MockLowLevelHttpRequest lowLevelHttpRequest)

Sets the MockLowLevelHttpRequest that will be returned by #buildRequest, if non-null. If null, #buildRequest 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.

Parameter
NameDescription
lowLevelHttpRequestMockLowLevelHttpRequest
Returns
TypeDescription
MockHttpTransport.Builder

setLowLevelHttpResponse(MockLowLevelHttpResponse lowLevelHttpResponse)

public final MockHttpTransport.Builder setLowLevelHttpResponse(MockLowLevelHttpResponse lowLevelHttpResponse)

Sets the MockLowLevelHttpResponse that will be the result when the MockLowLevelHttpRequest returned by #buildRequest is executed. Note that the response can be set only the caller has not provided a MockLowLevelHttpRequest via #setLowLevelHttpRequest.

Parameter
NameDescription
lowLevelHttpResponseMockLowLevelHttpResponse
Returns
TypeDescription
MockHttpTransport.Builder

setSupportedMethods(Set<String> supportedMethods)

public final MockHttpTransport.Builder setSupportedMethods(Set<String> supportedMethods)

Sets the supported HTTP methods or null to specify that all methods are supported.

Parameter
NameDescription
supportedMethodsSet<String>
Returns
TypeDescription
MockHttpTransport.Builder