Steps to test the application
**Prerequists:- java and maven should be installed previously.
- git clone https://github.com/prateek0227/transformersAPI.git
mvn spring-boot:run
- this will start the application atlocalhost:8080
- go to
http://localhost:8080/swagger-ui.html#!/transformer-controller
to test the apis from the browser
Main application file -
ApiApplication.java
Following APIs are present
- GET /transformers - get a list of all the saved transformers. Initially there are 5 pre loaded transformers.
- POST /transformers - save a transformer by passing in the required fields as json object
- GET /transformers/{id} - get details of a transformer by id
- PUT /transformers/{id} - update a transformer by id. If id does not exist, a new transformer will be created by using the details of the passed in transformer object but with an autogenerated id.
- DELETE /transformers/{id} - delete a transformer by id
- POST /getBattleResult - get the result of the battle by passing in valid transformer ids as a list.
To run unit and integration tests run the following command - mvn clean test
Unit Test file -
ServiceUnitTests.java
Integration Test file -ApiTest.java