Today’s strongly-typed, object-oriented programming languages give you the tools you need to pick up a lot of errors at compile-time, before even one line of your code is executed. However, many programmers don’t take advantage of strong types and write code using generic data types instead of taylormade data structures. This code tends to be error-prone and hard to understand. This article shows you the benefits of using dedicated data structures.
Most non-trivial applications, especially in today’s microservices world, will call other services using a REST API to perform a task. Unit testing parts of your application that call REST APIs can be difficult and error prone when just using JUnit and Mockito.
This post shows how to use WireMock to mock a REST service with both GET and POST methods in a unit test.