How renzomedina/calculate-order-mv works
Project Type and Purpose
• Full-stack? No UI here—this is a backend service (library/CLI style) that calculates order totals.
• Purpose: read a list of products, validate inputs, apply discounts, compute totals, and demonstrate unit testing and CI/CD.
File Structure
• src/main/java/com/ejemplo
• App.java – application entry point
• OrderService.java – core logic for summing products
• DiscountService.java – applies discount rules
• src/test/java/com/ejemplo
• Unit tests for App, OrderService, OrderService with mocks
• pom.xml – Maven build, dependencies, plugins (JUnit, JaCoCo)
• .github/workflows/maven-ci.yml – GitHub Actions pipeline
README Insights
• Stacks: Java 17+, Maven, JUnit, JaCoCo, GitHub Actions
• Input validation, unit testing, coverage reporting, CI automation
Main Components
a. Runtime Components
• Application (App)
• OrderService
• DiscountService
b. Supporting Tools / Build & Pipeline
• Maven Build
• JUnit Tests
• JaCoCo Coverage
• GitHub Actions CI
Relationships and Data Flow
• At runtime:
1. App reads input (list of products)
2. App calls OrderService.calculateTotal(products)
3. OrderService invokes DiscountService.applyDiscounts(order)
4. DiscountService returns adjusted totals → OrderService returns final total → App outputs result
• In CI: GitHub Actions triggers Maven → compiles code, runs JUnit tests → JaCoCo plugin generates coverage report
Architectural Patterns / Principles
• Service decomposition: business logic separated into OrderService and DiscountService
• Dependency injection (if used) or simple instantiation to allow mocking in tests
• Layered organization: application entrypoint vs. service layer vs. test layer
Technologies & Frameworks
• Java 17
• Maven (pom.xml)
• JUnit + Mockito (for OrderServiceMockTest)
• JaCoCo (coverage)
• GitHub Actions (CI pipeline)
Putting It All Together
Tier 1 (left) – CLI/Application Layer: App.java
Tier 2 (center) – Service Layer: OrderService, DiscountService
Tier 3 (right) – Data/Output: console output or generated total
• Below or aside, show the CI/CD pipeline:
• GitHub Actions → Maven compile/test → JUnit → JaCoCo report