public class HoverflyTestNG
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
after()
Stops the managed instance of Hoverfly
|
void |
assertThatNoDiffIsReported()
Asserts that there was no diff between any of the expected responses set by simulations and the actual responses
returned from the real service.
|
void |
assertThatNoDiffIsReported(boolean shouldResetDiff)
Asserts that there was no diff between any of the expected responses set by simulations and the actual responses
returned from the real service.
|
void |
before()
Starts an instance of Hoverfly
|
void |
capture(java.lang.String outputFilename)
Stores what's currently been captured in the currently assigned file, reset simulations and journal logs, then starts capture again
ready to store in the new file once complete.
|
void |
capture(java.lang.String outputDir,
java.lang.String outputFilename)
Stores what's currently been captured in the currently assigned file, reset simulations and journal logs, then starts capture again
ready to store in the new file once complete.
|
java.lang.String |
getAuthHeaderName()
Deprecated.
|
java.lang.String |
getAuthHeaderValue()
Deprecated.
|
io.specto.hoverfly.junit.core.HoverflyMode |
getHoverflyMode()
Gets started Hoverfly mode
|
int |
getProxyPort()
Gets the proxy port this has run on, which could be useful when running
Hoverfly on a random port. |
io.specto.hoverfly.junit.core.SslConfigurer |
getSslConfigurer() |
java.util.Map<java.lang.String,java.lang.String> |
getState()
Get all state from Hoverfly
|
static HoverflyTestNG |
inCaptureMode() |
static HoverflyTestNG |
inCaptureMode(io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig) |
static HoverflyTestNG |
inCaptureMode(java.lang.String outputFilename)
Instantiates a rule which runs
Hoverfly in capture mode |
static HoverflyTestNG |
inCaptureMode(java.lang.String outputFilename,
io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Instantiates a rule which runs
Hoverfly in capture mode |
static HoverflyTestNG |
inCaptureMode(java.lang.String outputDir,
java.lang.String outputFilename)
Instantiates a rule which runs
Hoverfly in capture mode |
static HoverflyTestNG |
inCaptureMode(java.lang.String outputDir,
java.lang.String outputFilename,
io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Instantiates a rule which runs
Hoverfly in capture mode |
static HoverflyTestNG |
inCaptureOrSimulationMode(java.lang.String recordFile)
Instantiates a rule which runs
Hoverfly in capture mode if
recorded file is not present, or in simulation mode if record file is present |
static HoverflyTestNG |
inCaptureOrSimulationMode(java.lang.String recordFile,
io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Instantiates a rule which runs
Hoverfly in capture mode if
recorded file is not present, or in simulation mode if record file is present |
static HoverflyTestNG |
inDiffMode()
Instantiates a rule which runs
Hoverfly in diff mode with no data |
static HoverflyTestNG |
inDiffMode(io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Instantiates a rule which runs
Hoverfly in diff mode with no data |
static HoverflyTestNG |
inDiffMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource)
Instantiates a rule which runs
Hoverfly in diff mode |
static HoverflyTestNG |
inDiffMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource,
io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Instantiates a rule which runs
Hoverfly in diff mode |
static HoverflyTestNG |
inSimulationMode()
Instantiates a rule which runs
Hoverfly in simulate mode with no data |
static HoverflyTestNG |
inSimulationMode(io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Instantiates a rule which runs
Hoverfly in simulate mode with no data |
static HoverflyTestNG |
inSimulationMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource)
Instantiates a rule which runs
Hoverfly in simulate mode |
static HoverflyTestNG |
inSimulationMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource,
io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig) |
static HoverflyTestNG |
inSpyMode()
Instantiates a rule which runs
Hoverfly in spy mode with no data |
static HoverflyTestNG |
inSpyMode(io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Instantiates a rule which runs
Hoverfly in spy mode with no data |
static HoverflyTestNG |
inSpyMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource)
Instantiates a rule which runs
Hoverfly in spy mode |
static HoverflyTestNG |
inSpyMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource,
io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig) |
HoverflyTestNG |
printSimulationData()
Print the simulation data to console for debugging purpose.
|
void |
resetDiffs() |
void |
resetJournal() |
void |
resetState()
Deletes all state from Hoverfly
|
void |
setState(java.util.Map<java.lang.String,java.lang.String> state)
Deletes all state from Hoverfly and then sets the state.
|
void |
simulate(io.specto.hoverfly.junit.core.SimulationSource simulationSource,
io.specto.hoverfly.junit.core.SimulationSource... sources)
Changes the Simulation used by
Hoverfly
It also reset the journal to ensure verification can be done on the new simulation source. |
void |
updateState(java.util.Map<java.lang.String,java.lang.String> state)
Updates state in Hoverfly.
|
void |
verify(io.specto.hoverfly.junit.dsl.RequestMatcherBuilder requestMatcher) |
void |
verify(io.specto.hoverfly.junit.dsl.RequestMatcherBuilder requestMatcher,
io.specto.hoverfly.junit.verification.VerificationCriteria criteria) |
void |
verifyAll() |
void |
verifyZeroRequestTo(io.specto.hoverfly.junit.dsl.StubServiceBuilder requestedServiceBuilder) |
public static HoverflyTestNG inCaptureOrSimulationMode(java.lang.String recordFile)
Hoverfly in capture mode if
recorded file is not present, or in simulation mode if record file is presentrecordFile - the path where captured or simulated traffic is taken. Relative to src/test/resources/hoverflypublic static HoverflyTestNG inCaptureOrSimulationMode(java.lang.String recordFile, io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Hoverfly in capture mode if
recorded file is not present, or in simulation mode if record file is presentrecordFile - the path where captured or simulated traffic is taken. Relative to src/test/resources/hoverflyhoverflyConfig - the configpublic static HoverflyTestNG inCaptureMode()
public static HoverflyTestNG inCaptureMode(io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
public static HoverflyTestNG inCaptureMode(java.lang.String outputFilename)
Hoverfly in capture modeoutputFilename - the output simulation file name relative to src/test/resources/hoverflypublic static HoverflyTestNG inCaptureMode(java.lang.String outputFilename, io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Hoverfly in capture modeoutputFilename - the output simulation file name relative to src/test/resources/hoverflyhoverflyConfig - the configpublic static HoverflyTestNG inCaptureMode(java.lang.String outputDir, java.lang.String outputFilename)
Hoverfly in capture modeoutputDir - the directory path relative to your project root for exporting the simulation fileoutputFilename - the output simulation file namepublic static HoverflyTestNG inCaptureMode(java.lang.String outputDir, java.lang.String outputFilename, io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Hoverfly in capture modeoutputDir - the directory path relative to your project root for exporting the simulation fileoutputFilename - the output simulation file namehoverflyConfig - the configpublic static HoverflyTestNG inSimulationMode()
Hoverfly in simulate mode with no datapublic static HoverflyTestNG inSimulationMode(io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Hoverfly in simulate mode with no datahoverflyConfig - the configpublic static HoverflyTestNG inSimulationMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource)
Hoverfly in simulate modesimulationSource - the simulation to importpublic static HoverflyTestNG inSimulationMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource, io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
public static HoverflyTestNG inSpyMode()
Hoverfly in spy mode with no datapublic static HoverflyTestNG inSpyMode(io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Hoverfly in spy mode with no datahoverflyConfig - the configpublic static HoverflyTestNG inSpyMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource)
Hoverfly in spy modesimulationSource - the simulation to importpublic static HoverflyTestNG inSpyMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource, io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
public static HoverflyTestNG inDiffMode()
Hoverfly in diff mode with no datapublic static HoverflyTestNG inDiffMode(io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Hoverfly in diff mode with no datahoverflyConfig - the configpublic static HoverflyTestNG inDiffMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource)
Hoverfly in diff modesimulationSource - the simulation to import the responses will be compared topublic static HoverflyTestNG inDiffMode(io.specto.hoverfly.junit.core.SimulationSource simulationSource, io.specto.hoverfly.junit.core.HoverflyConfig hoverflyConfig)
Hoverfly in diff modesimulationSource - the simulation to import the responses will be compared tohoverflyConfig - the configpublic void before()
public void after()
public int getProxyPort()
Hoverfly on a random port.public io.specto.hoverfly.junit.core.SslConfigurer getSslConfigurer()
public io.specto.hoverfly.junit.core.HoverflyMode getHoverflyMode()
public void simulate(io.specto.hoverfly.junit.core.SimulationSource simulationSource,
io.specto.hoverfly.junit.core.SimulationSource... sources)
Hoverfly
It also reset the journal to ensure verification can be done on the new simulation source.simulationSource - the simulationpublic void capture(java.lang.String outputFilename)
outputFilename - the output simulation file name relative to src/test/resources/hoverflypublic void capture(java.lang.String outputDir,
java.lang.String outputFilename)
outputDir - the directory path relative to your project root for exporting the simulation fileoutputFilename - the output simulation file name relative to src/test/resources/hoverfly@Deprecated public java.lang.String getAuthHeaderName()
@Deprecated public java.lang.String getAuthHeaderValue()
public HoverflyTestNG printSimulationData()
public void verify(io.specto.hoverfly.junit.dsl.RequestMatcherBuilder requestMatcher)
public void verify(io.specto.hoverfly.junit.dsl.RequestMatcherBuilder requestMatcher,
io.specto.hoverfly.junit.verification.VerificationCriteria criteria)
public void verifyZeroRequestTo(io.specto.hoverfly.junit.dsl.StubServiceBuilder requestedServiceBuilder)
public void verifyAll()
public void resetJournal()
public void resetState()
public java.util.Map<java.lang.String,java.lang.String> getState()
public void setState(java.util.Map<java.lang.String,java.lang.String> state)
state - the new statepublic void updateState(java.util.Map<java.lang.String,java.lang.String> state)
state - the state to update withpublic void resetDiffs()
public void assertThatNoDiffIsReported()
public void assertThatNoDiffIsReported(boolean shouldResetDiff)
shouldResetDiff says if all available diffs should be removed when the assertion is done.shouldResetDiff - if all available diffs should be removed when the assertion is done.