Unit Tests for Product Routes Part 1
Explore unit testing strategies for product routes in Scala HTTP APIs. Learn to handle requests for existing and non-existing products, create valid URIs, and validate status codes and response bodies. Understand the use of implicit JSON encoders and EntityDecoders in testing context.
We'll cover the following...
We'll cover the following...
Querying a non-existing product
Above, you can see the test for querying a non-existing product. This must return an empty response using a 404 Not Found status code (Line 2).
First, we try to create a valid URI from our generated ProductId. If that is successful, we create a small service wrapper for our ...