Part of the Alchemy Collection.
Alchemy HTTP Mock makes Unit Testing with Alchemy HTTP breezy. This allows testing without hitting any actual networks.
You can Stub Behavior using Mockito style syntax.
To use, simply add the following maven dependency.
<dependency>
<groupId>tech.sirwellington.alchemy</groupId>
<artifactId>alchemy-http-mock</artifactId>
<version>2.0</version>
<!-- Designed for Unit Testing -->
<scope>test</scope>
</dependency>
First add the Snapshot Repository
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<dependency>
<groupId>tech.sirwellington.alchemy</groupId>
<artifactId>alchemy-http-mock</artifactId>
<version>2.1-SNAPSHOT</version>
</dependency>
Use AlchemyHttpMock
to create Mock Http Clients.
AlchemyHttp http;
//...
http = AlchemyHttpMock.begin()
.whenPost()
.anyBody()
.at(url)
.thenReturnResponse(response)
.build();
//Use mock...
//Verify expected requests were made.
AlchemyHttpMock.verifyAllRequestsMade(http);
- Java 8
- Maven installation
To build, just run a mvn clean install
to compile and install to your local maven repository
Feature Requests are definitely welcomed! Please drop a note in Issues.
- Rewritten in Kotlin
- Compatibility with Android
- Lighter overall footprint
- Bugfixes and improvements
- Initial Public Release
This Software is licensed under the Apache 2.0 License