cd server
mvn testmvn test -Dtest=OrderServiceTest
mvn test -Dtest=ProductServiceTest
mvn test -Dtest=OrderControllerTestmvn test jacoco:report
# Report will be in: target/site/jacoco/index.html- ✅
createOrder_Success- Happy path - ✅
createOrder_InsufficientStock- Edge case
- ✅
getAllProducts_Success - ✅
getProductById_Success - ✅
getProductById_NotFound - ✅
createProduct_Success - ✅
updateProduct_Success - ✅
updateProduct_NotFound - ✅
deleteProduct_Success - ✅
deleteProduct_NotFound
- ✅
createOrder_Success - ✅
createOrder_ValidationError_EmptyItems - ✅
getMyOrders_Success
Total: 13 tests
docker-compose up --buildcurl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"password": "password123"
}'curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"password": "password123"
}'Save the JWT token from response!
curl -X POST http://localhost:8080/api/orders \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"items": [
{"productId": 1, "quantity": 0}
]
}'Expected: 400 Bad Request with validation error
curl http://localhost:8080/actuator/healthExpected: {"status":"UP"}
- Open: http://localhost:8080/swagger-ui.html
- Click "Authorize" button
- Paste JWT token (without "Bearer ")
- Test all endpoints interactively!
Run this test to simulate concurrent updates:
# Terminal 1 & 2 simultaneously:
curl -X POST http://localhost:8080/api/orders \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"items": [{"productId": 1, "quantity": 99}]
}'One should succeed, the other should get 409 Conflict.
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.nexusflow.server.service.OrderServiceTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO] Running com.nexusflow.server.service.ProductServiceTest
[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
[INFO] Running com.nexusflow.server.controller.OrderControllerTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] BUILD SUCCESS
✅ All tests passing!