To demonstrate unit testing on REST API service.
Category | Value |
---|---|
Language | Java |
Build Tool | Maven |
Test Tool | JUNIT5 |
framework | Spring Boot |
Report | Maven Surefire Report Plugin |
- GET currency conversion for example USD => INR
- To demonstrate unit testing practices on different layers
- Controller Layer
- Data layer
- Service Layer
- Integration Test to test all layers
Brief description on the important packages.
- WebMockMvc to test Controller layer logic in isolation.
- DataJpa to test Data layer that is Jpa Repository.
- Mockito to test service layer logic in isolation
- Rest Template to perform Integration test
spring profiles -
- default - application.yml
Run tests:
mvn clean test surefire-report:report
Maven Surefire Report Plugin will generate report all the test run in the execution
Sample screenshot of report for the execution below: