-
Notifications
You must be signed in to change notification settings - Fork 12
Testing and Verification
tien.nguyen edited this page Jul 30, 2026
·
3 revisions
The Emporia Trading Platform employs a multi-layered verification strategy combining automated unit tests, integration tests with real databases, deterministic concurrency schedulers, and static code quality enforcement.
| Layer | Tools & Frameworks | Target & Purpose | Verification Command |
|---|---|---|---|
| Unit & Mock Testing | JUnit 5, Mockito, AssertJ | Individual business logic, records, state machines | mvn test |
| Code Coverage | JaCoCo (0.8.15) |
Enforcement of 91.95%+ instruction & branch coverage | mvn verify |
| Database Concurrency | Testcontainers, PostgreSQL | Pessimistic vs Optimistic locking under parallel transactions | mvn test -Dtest=*PostgresConcurrencySpec |
| Controlled Concurrency | Fray Scheduler (0.9.0) |
Controlled JVM thread interleavings (200 iterations, 170 timelines) | mvn -Pfray -pl order-management-service -am test |
| Static Code Quality | PMD (7.26.0), Custom Ruleset |
Code correctness, resource management, exception handling | mvn pmd:check |
- Every microservice defines a strict JaCoCo enforcement profile requiring minimum 90% instruction and branch coverage.
- Excludes auto-generated Protocol Buffers / gRPC classes and FIX protocol models.
# Run test suite with JaCoCo coverage reports across all 9 modules
mvn clean verify-
Specification:
TradingOrderPostgresConcurrencySpecinorder-management-service. -
Purpose: Spawns ephemeral PostgreSQL instances via Testcontainers to verify JPA
@Versionoptimistic locking and SQL pessimistic write locks under heavy concurrent transaction load.
-
Specification:
TradingOrderFraySpecinorder-management-service. -
Purpose: Uses Fray's byte-code instrumentation to explore 200 distinct thread interleavings between simultaneous
applyFillandcancelexecutions on sharedTradingOrderentities.
# Run Fray controlled thread scheduling specification
mvn -Pfray -pl order-management-service -am test-
Ruleset:
static-analysis/ruleset.xml. -
Enforces:
- Proper exception catching (no swallowed exceptions).
- Explicit resource cleanup (try-with-resources).
- Clean concurrency primitives.
- Zero violation tolerance (
pmd.failOnViolation=true).
# Run PMD static code check
mvn pmd:check -Dpmd.failOnViolation=true- Trading Terminology Glossary
- Order Lifecycle & Validation
- Order Routing & SOR
- Market Data & Pricing
- Portfolio & Risk Management
- Architecture & Order Flow
- Static Data Service
- Market Data Service
- Order Command Service
- Order Management Service (OMS)
- Execution Service
- Portfolio Service
- Design Patterns
- Microservices Overview
- Exchange-Core Integration
- Testing & Verification
- Deployment & Operations
- Repository: emporia
- Tech Stack: Java 21 | Spring Boot 4.0.7 | React 19 | Kafka | gRPC
- Coverage: 91.95% JaCoCo