REST Endpoint Testing With MockMvc

REST Endpoint Testing With MockMvc In this post I'm going to show you how to test a Spring MVC Rest endpoint without deploying your application to a server. In the past, full integration tests were the only meaningful way to test a Spring REST endpoint. This involved spinning up a test server like Tomcat or Jetty, deploying the application, calling the test endpoint, running some assertions and then terminating the server. While this is an effective way to test an endpoint, it isn't particularly fast. We're forced to wait while the entire application is stood up, just to test a single endpoint. An alternative approach [...]

By |2019-02-11T07:31:42+01:00May 25th, 2017|REST, Spring Boot, Testing|0 Comments

An Introduction to Wiremock

An Introduction to Wiremock This post provides a brief introduction to Wiremock, showing how it can be used to to quickly and easily mock remote API calls. We'll use Wiremock to write some integration tests for a simple Dropwizard app and show you how it can be put to use in a real world scenario. Why do I need to mock API calls? There are a number of scenarios where it makes sense to mock an external API rather than call a live service. The external API may still be in development and not yet available for integration. In this instance as long as a [...]

By |2019-02-18T07:10:56+01:00May 17th, 2016|Testing|3 Comments