Skip to content

Rest Service Mock using Wiremock Example with SpringBoot application

License

Notifications You must be signed in to change notification settings

wszczepaniak/wiremock-example

Repository files navigation

wiremock-example

Rest Service Mock using Wiremock Example with SpringBoot application

Prerequisites

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

Running tests

You can run tests from commandline using

  • gradlew test - in windows commandline
  • ./gradlew test - in PROPER consoles ;)

The main dish

Java based usage of Wiremock resides in src/test/java/example/LocalControllerTest.java

Wiremock standalone

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.

Postman

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.

About

Rest Service Mock using Wiremock Example with SpringBoot application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages