Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Hoverfly Java JUnit5

CircleCI Read the Docs Maven Central

JUnit 5 Extension for integrating Hoverfly into JUnit 5 testings.

Documentation

Full documentation is available here

Maven Dependency

<dependency>
    <groupId>io.specto</groupId>
    <artifactId>hoverfly-java-junit5</artifactId>
    <version>0.14.0</version>
    <scope>test</scope>
</dependency>

Example

Simulate

@HoverflySimulate(source = @HoverflySimulate.Source(value = "test-service-https.json", type = HoverflySimulate.SourceType.CLASSPATH))
@ExtendWith(HoverflyExtension.class)
class SimulationTests {
    // ...
}

Capture

@HoverflyCapture(path = "build/resources/test/hoverfly",
            filename = "captured-simulation.json",
            config = @HoverflyConfig(captureAllHeaders = true, proxyLocalHost = true))
@ExtendWith(HoverflyExtension.class)
class CaptureTests {
    // ...
}

Dependency Injection for Hoverfly

@ExtendWith(HoverflyExtension.class)
class MyTests {
    // ...

    @BeforeEach
    void setup(Hoverfly hoverfly) {
        // ...
    }

    @Test
    void shouldDoSomethingWith(Hoverfly hoverfly) {
        // ...
    }
}

Contributions

Contributions are welcome!

To submit a pull request you should fork the Hoverfly-Java repository, and make your change on a feature branch of your fork.

Issues

Feel free to raise an issues on Github.

License

Apache License version 2.0.

(c) SpectoLabs 2018.