Rest Service Mock using Wiremock Example with SpringBoot application
This project uses springboot, junit, lombok, gradle.
- Recomended IDE : IntelliJ with enabled gradle functionality and lombok plugin, also enabled annotation processing is required.
- Java 8
You can run tests from commandline using
gradlew test
- in windows commandline./gradlew test
- in PROPER consoles ;)
Java based usage of Wiremock resides in src/test/java/example/LocalControllerTest.java
You can run a standalone instance of Wiremock for use in several applications. Standalone version is manageable in real-time (by json requests) or can be supported by the files inside mappings and __files directory
Example running command from the wiremock-standalone directory :
java -jar wiremock-standalone-2.5.1.jar --verbose --port 8090
I prepared one request stub inside wiremock-standalone/mapping directory, you can check it out.
For fluent work with REST requests I personally use Postman application for Chrome browser. I prepared simple postman collection, importable into postman, so you could directly start testing wiremock solution Postman request collection resides in postman-collection directory.