A Spring Boot application for creating and managing HTTP mocks using WireMock and MongoDB.
- Java 24 - Latest Java features and performance improvements
- Spring Boot 3.5.4 - Modern Spring framework with enhanced capabilities
- Gradle (Kotlin DSL) - Type-safe build automation
- WireMock 3.13.1 - Powerful HTTP service virtualization
- MongoDB - Flexible document storage for mock configurations
- Spring Boot Actuator - Production-ready monitoring and health checks
- Lombok - Reduced boilerplate code
- Testcontainers - Integration testing with real services
- Java 24 or higher
- Docker Desktop - Required for running tests (uses Testcontainers for MongoDB)
- MongoDB (optional for basic testing - can be configured later)
- Git for version control
The project uses Testcontainers for integration testing, which requires Docker to be running:
- Install Docker Desktop for your operating system
- Start Docker Desktop and ensure it's running
- Verify Docker is running:
docker infoshould not show connection errors
git clone <your-repo-url>
cd Mock-Service./gradlew build./gradlew bootRunOpen another terminal and run:
curl http://localhost:8080/actuator/healthExpected response:
{"status":"UP"}| Command | Description |
|---|---|
./gradlew build |
Build the project and run tests |
./gradlew bootRun |
Start the application with hot reload |
./gradlew test |
Run all tests |
./gradlew clean |
Clean build artifacts |
./gradlew clean build |
Clean and build from scratch |
- Health Check:
GET /actuator/health - Application Info:
GET /actuator/info - Metrics:
GET /actuator/metrics
Coming soon - Mock CRUD operations
Mock-Service/
├── src/
│ ├── main/
│ │ ├── java/com/example/mockservice/
│ │ │ └── MockServiceApplication.java
│ │ └── resources/
│ │ ├── application.properties
│ │ ├── static/
│ │ └── templates/
│ └── test/
│ └── java/com/example/mockservice/
├── gradle/
├── build.gradle.kts
├── settings.gradle.kts
└── README.md
The application uses application.properties for configuration. Key settings:
- Server Port:
8080(default) - MongoDB: Auto-configuration (when available)
- Actuator: Health endpoints enabled
# Ensure Docker Desktop is running first
docker info
# Run all tests
./gradlew testThe project includes:
- Unit tests for core functionality
- Integration tests with Testcontainers
- MongoDB integration testing using Docker containers
If tests fail with Docker-related errors:
- Ensure Docker Desktop is installed and running
- Verify Docker connectivity:
docker info - On Windows: Check that Docker Desktop is using the correct engine (WSL2 or Hyper-V)
Coming soon - Docker containerization
- Basic WireMock integration
- MongoDB mock storage
- REST API for mock management
- Web UI for mock configuration
- Request/Response logging
- Mock templates and scenarios
- API documentation with Swagger
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Build fails with Java version error:
- Ensure Java 24 is installed and
JAVA_HOMEis set correctly
Tests fail with Docker/Testcontainers errors:
- Ensure Docker Desktop is installed and running
- Run
docker infoto verify Docker connectivity - On Windows: Make sure Docker Desktop is using the correct engine
WireMock HttpServerFactory errors:
- This project uses
wiremock-standalonefor better Java 21+ compatibility - If you see "Jetty 11 is not present" errors, ensure you're using the standalone version
- The standalone version includes all necessary HTTP server dependencies
Application won't start - MongoDB connection error:
- MongoDB connection is optional for basic functionality
- Configure
spring.data.mongodb.uriin application.properties if needed
Port 8080 already in use:
- Change the port in application.properties:
server.port=8081
Happy Mocking! 🎭