Skip to content

To demonstrate unit testing on Rest API service using JAVA Spring Boot

Notifications You must be signed in to change notification settings

Premraj1212/unit-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unit Test

To demonstrate unit testing on REST API service.

Unit test for API service built in Java

Stack

Category Value
Language Java
Build Tool Maven
Test Tool JUNIT5
framework Spring Boot
Report Maven Surefire Report Plugin

API Service

  • GET currency conversion for example USD => INR

Objective

  • To demonstrate unit testing practices on different layers
  • Controller Layer
  • Data layer
  • Service Layer
  • Integration Test to test all layers

Approach

Brief description on the important packages.

features

  • 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

Reports

Maven Surefire Report Plugin will generate report all the test run in the execution

Sample screenshot of report for the execution below:

surefire Report

About

To demonstrate unit testing on Rest API service using JAVA Spring Boot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages