In this exam problem you will write the code for a simple email system. I have already written the controller classes and DTOs for this application. Your job will be to construct entity classes for the application and finish writing the code for the EmailService class.
Once the code for the application is complete you will also write a collection of test methods to test the API. I have provided you with some code to get started in the APITests.java file in the src/test/java folder.
Click the button above to download the starter project for this exam.
You will be writing code for two entity classes, a User class and a Message class. Here are some suggestions for how to set these classes up:
One of the things you will be doing is writing code to delete a message. When you delete a message you should remove it from the list of messages that the recipient of that message has received. The message will not get removed from the list of messages the sender has sent, the message will not get removed from the database, and the recipient will not get removed from the list of Users the message was sent to.
You will also be writing tests for this application. I have already provided you with the skeleton of a test class in the APITests.java file. You will be writing tests for each one of the controller methods in the controller classes. Follow the suggestions in the comments I have provided in the APITests.java file.