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 (Stubbings).
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
Constructors -
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 addStubbings.- Returns:
- this
-
address
- Returns:
- the
HttpStubbase address
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-