Package org.stubit.http
Class HttpStub
java.lang.Object
org.stubit.http.HttpStub
- All Implemented Interfaces:
AutoCloseable
A
HttpStub
wraps an HttpServer
that is started locally on a dynamic port to serve
fixed stubbed responses (Stubbing
s).
This can be used to simulate (stub) a remote service used in your production code. In order to
do so, you need to configure your code to call the HttpStub
's address
instead of the actual service address.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
HttpStub
public HttpStub()Creates and starts the HttpStub.
-
-
Method Details
-
add
- Parameters:
stubbings
-Stubbing
(s) to be added- Returns:
- this
-
reset
Removes addStubbing
s.- Returns:
- this
-
address
- Returns:
- the
HttpStub
base address
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-