Final project round
In the final round of the project you will implement two important additions to your project: security and end-to-end testing.
Implementing security
For the final version of your project you will be securing most of your API with jwts. To do this, you can follow the steps I laid out in the lecture on security.
Here are some important things to implement:
- You will have to modify most of your controller methods to take an additional parameter which is an Authentication object.
- The Authentication object should be your source for information on which user requested the action. If the controller method receives an additional parameter which is a DTO, and that DTO contains a user id, you should ignore the DTO's user id in favor of the user id stored in the Authentication object.
Writing end-to-end tests
Once you have implemented security, your final task will be to write tests. For this assignment you will be writing only end-to-end tests using the REST Assured library.
The tests you write should demonstrate that all of the activities needed to post an item, select a recipient, and complete the transfer are supported correctly by your system. Specifically, you should write tests to demonstrate that the following actions can be completed successfully in your system:
- Create some users: a donor, and two other users to act as potential recipients.
- Log in users and get a jwt for those users.
- Donor posts an item to be donated.
- Item shows up in the list of items being offered.
- Both potential recipients express interest in the item.
- The donor selects a recipient.
- The donor and recipient work out a meeting time and place.
- The transfer is concluded successfully.