Skip to content

Latest commit

 

History

History
111 lines (74 loc) · 2.52 KB

README.md

File metadata and controls

111 lines (74 loc) · 2.52 KB

Alchemy HTTP Mock

"Mock the World"

Build Status Maven Central Version

Purpose

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.

Download

To use, simply add the following maven dependency.

Release

<dependency>
	<groupId>tech.sirwellington.alchemy</groupId>
	<artifactId>alchemy-http-mock</artifactId>
    <version>2.0</version>
    <!--  Designed for Unit Testing -->
    <scope>test</scope>
</dependency>

Snapshot

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>

API

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);

Requirements

  • Java 8
  • Maven installation

Building

To build, just run a mvn clean install to compile and install to your local maven repository

Feature Requests

Feature Requests are definitely welcomed! Please drop a note in Issues.

Release Notes

3.0

  • Rewritten in Kotlin
  • Compatibility with Android
  • Lighter overall footprint

2.0 Dependency Updates

1.1

  • Bugfixes and improvements

1.0

  • Initial Public Release

License

This Software is licensed under the Apache 2.0 License

http://www.apache.org/licenses/LICENSE-2.0