I already know how to write JUnit test cases (can also use Mockito). Thanks for the simple tutorials in the web for that. The only problem is that I can't find any examples on implementing it to an actual or let's say realistic project.
I have a simple REST web service which uses Servlets. It has an API method that sends a POST request to another web service then arranges the data as its response.
The API request is processed by two layers:
- Servlet (Controller) - validates the request parameters
- Service - The sender of the POST request to another web service
Here's what the service method does:
- Prepares a parameter data (some attributes are provided in the paramaters of this request, some are retrieved from the database)
- sends a request to another web service which responds with an image url for a QR Code
- Decodes the QRCode image and then responds to its request with the decoded text
What are the unit tests cases needed for this?
How about integration tests? Do I have to use ServletUnit, or can I just run the server and write tests with requests to the running server?
Aucun commentaire:
Enregistrer un commentaire