Java Machine Coding Round
Time : 45 mins
Description :
You would need to create a spring boot web app with User entity and the
ability to do the following api operations:
i. Get user details of all users
ii. Fetch user based on Id
iii. Update details for a User
iv. Delete a user based on id
1. Create a new spring boot project
2. Add any relevant dependencies
3. Create a User entity with the following Fields :
a. Id (Long)
b. Name
c. Address
d. PlanName
e. SubscriptionDate (Timestamp)
4. Create a jpa repository interface for the User
5. Create a service class to handle the following:
a. Save a new user in db
b. Get user by id
c. Get all users
d. Update user details
e. Delete a user
6. Create a controller class with the following rest api’s endpoints:
a. /user – to save a new user
b. /users – to get all users
c. /user/{id} – to get user by id
d. /user/{id} – update user details for the given user id and
updated details passed in request body
e. /user/{id} – to delete a user based on Id
Please make sure to use correct syntax, proper variable names, rest
mappings, exception handling of responses wherever need be.