hint: This can be tested with Postman or preferable by creating a unit test
When you're creating a unit test, it might help to use MockMvc
help: https://spring.io/guides/gs/testing-web/
Create a simple REST-API that returns a JSON with an array of objects wit the following data:
Firstname: Anna
Lastname: Hansen
Age: 28
Citizenship: DanishFirstname: Mark
Lastname: Eriksen
Age: 30
Citizenship: NorwegianFirstname: Fritz
Lastname: Petersen
Age: 48
Citizenship: German
The REST-API must be secured with Basic Authentication.
Use the following credentials
Username: admin
Password: admin
Create a simple REST-API that receives the generated JSON of the first task and puts the data into POJOs and prints them well formatted to the console.
##Solution
I created API for getting list of user. You can test via Postmanas well as.
List of user endpoint is : localhost:8080/api/users As per task Basic Authentication required Username: admin Password: admin
Also you can check console log for output and check test caseas well as.