Class MockHttpTransport.Builder (1.43.2)

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
Type Description
MockHttpTransport

getLowLevelHttpRequest()

public final MockLowLevelHttpRequest getLowLevelHttpRequest()

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

Returns
Type Description
MockLowLevelHttpRequest

getSupportedMethods()

public final Set<String> getSupportedMethods()

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

Returns
Type Description
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
Name Description
lowLevelHttpRequest MockLowLevelHttpRequest
Returns
Type Description
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
Name Description
lowLevelHttpResponse MockLowLevelHttpResponse
Returns
Type Description
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
Name Description
supportedMethods Set<String>
Returns
Type Description
MockHttpTransport.Builder