This project demonstrates how to test Spring WebFlux controllers and services using JUnit 5 and Mockito. It includes the following components:
- UserController: REST controller responsible for handling user-related HTTP requests.
- UserService: Service interface defining operations related to user management.
- UserServiceImpl: Implementation of the UserService interface.
- UserRepository: Reactive CRUD repository for managing user data.
- UserControllerTest: JUnit 5 test class for testing UserController methods.
- UserServiceTest: JUnit 5 test class for testing UserService methods.
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/iammahesh123/spring-webflux-testing-demo.git
-
Import the project into your preferred IDE.
-
Run the JUnit tests located in the
src/test/java
directory.
- Java
- Spring Reactive
- Mongodb
- JUnit 5
- Mockito
- Reactor
-
Run the provided JUnit tests to ensure that the UserController and UserService are functioning as expected.
-
Modify or extend the UserController and UserService as needed for your application requirements.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or create a pull request.
This project is licensed under the MIT License.