Today, I’ll add the ability to edit users. This will be easy, as most of the pieces are already in place. First, I’ll add a new editUser method that accepts an updated user object, verifies that the user exists and then saves the updated user object. The only differences between the new editUser method and the existing postUser method are:
- Invert the test on users.containsKey() to throw an error when the user does not exist (editUser) rather than when the user already exists (postUser).
- New method name and @Path annotation