public class HoverflyExtension
extends java.lang.Object
implements org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.ParameterResolver
Hoverfly.exportSimulation(Path) or Hoverfly.simulate(SimulationSource, SimulationSource...)}
It implements ParameterResolver which gives you the flexibility to inject the current Hoverfly instance into JUnit 5 annotated method,
and make use of the Hoverfly API directly.
HoverflyCore annotation can be used along with HoverflyExtension to set the mode and customize the configurations.for more configuration options
{@link HoverflySimulate} annotation can be used to instruct Hoverfly to load simulation from a file located at
Hoverfly default path (src/test/resources/hoverfly) and file called with fully qualified name of test class, replacing dots (.) and dollar signs ($) to underlines (_).,
for more configuration options
{@link HoverflyCapture} annotation can be used to config Hoverfly to capture and export simulation to a file located at
Hoverfly default path (src/test/resources/hoverfly) and file called with fully qualified name of test class, replacing dots (.) and dollar signs ($) to underlines (_).,
for more configuration options
{@link HoverflyDiff} annotation can be used along with HoverflyExtension to set the mode to diff and customize the configurations.,
for more configuration options*| Constructor and Description |
|---|
HoverflyExtension() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterAll(org.junit.jupiter.api.extension.ExtensionContext context) |
void |
afterEach(org.junit.jupiter.api.extension.ExtensionContext context) |
void |
beforeAll(org.junit.jupiter.api.extension.ExtensionContext context) |
void |
beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) |
protected java.lang.String |
getPath(org.junit.jupiter.api.extension.ExtensionContext context,
HoverflySimulate.Source source)
Returns the path to the simulation source.
|
java.lang.Object |
resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
boolean |
supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)
beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallbackpublic void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallbackprotected java.lang.String getPath(org.junit.jupiter.api.extension.ExtensionContext context,
HoverflySimulate.Source source)
context - the current extension context; never nullsource - the simulation source annotation; never nullpublic void afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
afterAll in interface org.junit.jupiter.api.extension.AfterAllCallbackpublic boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext)
throws org.junit.jupiter.api.extension.ParameterResolutionException
supportsParameter in interface org.junit.jupiter.api.extension.ParameterResolverorg.junit.jupiter.api.extension.ParameterResolutionExceptionpublic java.lang.Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext)
throws org.junit.jupiter.api.extension.ParameterResolutionException
resolveParameter in interface org.junit.jupiter.api.extension.ParameterResolverorg.junit.jupiter.api.extension.ParameterResolutionExceptionpublic void afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback