We will create a REST service using spring boot which will have an endpoint to upload the file. Then we create JUnit test for upload service using mocking. Maven dependency <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> REST Service for file upload Below service reads the content of uploaded file and print on the console. Client application will upload the file using given endpoint ...
Blogs about Java, J2ee, Multithreading, Data structure, Algorithm, Spring framework, Spring boot, Web services and open source technologies