Package au.com.dius.pact.provider.junit5
Class HttpTestTarget
-
- All Implemented Interfaces:
-
au.com.dius.pact.provider.junit5.TestTarget
public class HttpTestTarget implements TestTarget
Test target for HTTP tests. This is the default target.
-
-
Constructor Summary
Constructors Constructor Description HttpTestTarget(String host, Integer port, String path, Function0<IHttpClientFactory> httpClientFactory)HttpTestTarget(String host, Integer port, String path)HttpTestTarget(String host, Integer port)HttpTestTarget(String host)HttpTestTarget()
-
Method Summary
Modifier and Type Method Description Map<String, Object>getUserConfig()Any user provided configuration final StringgetHost()Host to bind to. final IntegergetPort()Port that the provider is running on. final StringgetPath()The path that the provider is mounted on. final Function0<IHttpClientFactory>getHttpClientFactory()BooleanisHttpTarget()If this is a request response (HTTP or HTTPS) target IProviderInfogetProviderInfo(String serviceName, PactSource pactSource)Returns information about the provider Pair<Object, Object>prepareRequest(Pact pact, Interaction interaction, Map<String, Object> context)Prepares the request for the interaction. UnitprepareVerifier(IProviderVerifier verifier, Object testInstance, Pact pact)Prepares the verifier for use during the test ProviderResponseexecuteInteraction(Object client, Object request)Executes the test (using the client and request from prepareRequest, if any) final static HttpTestTargetfromUrl(URL url)Creates a HttpTestTarget from a URL. -
-
Method Detail
-
getUserConfig
Map<String, Object> getUserConfig()
Any user provided configuration
-
getHttpClientFactory
final Function0<IHttpClientFactory> getHttpClientFactory()
-
isHttpTarget
Boolean isHttpTarget()
If this is a request response (HTTP or HTTPS) target
-
getProviderInfo
IProviderInfo getProviderInfo(String serviceName, PactSource pactSource)
Returns information about the provider
-
prepareRequest
Pair<Object, Object> prepareRequest(Pact pact, Interaction interaction, Map<String, Object> context)
Prepares the request for the interaction.
-
prepareVerifier
Unit prepareVerifier(IProviderVerifier verifier, Object testInstance, Pact pact)
Prepares the verifier for use during the test
-
executeInteraction
ProviderResponse executeInteraction(Object client, Object request)
Executes the test (using the client and request from prepareRequest, if any)
-
fromUrl
final static HttpTestTarget fromUrl(URL url)
Creates a HttpTestTarget from a URL. If the URL does not contain a port, 8080 will be used.
-
-
-
-