Unit Tests for Products Routes Part 3
Explore how to create and execute unit tests for product-related HTTP routes in Scala using pure functional programming techniques. Understand testing with valid and garbage JSON data, test repository behavior, and streaming responses to ensure your API handles products correctly.
We'll cover the following...
We'll cover the following...
Create a product
Before we work on our Products Routes tests, we need to adapt the code to create a product using the knowledge we gained from our Product Route update test.
Garbage values
Moving on to our tests: We will start with sending garbage JSON via the POST request.
There is nothing special here. The test is the same as for the Product Routes except for the changed URI and HTTP method. The code is also a bit ...