test: expand service coverage and modernize test infrastructure
- replace legacy mockito-all with mockito-junit-jupiter - add tests for AppState, MQTT service, process manager, and animation file service - rewrite service tests for stronger edge-case coverage - refactor services for testability (MQTT client/process launcher/output path injection) - fix duplicate payload ID handling in BinaryEventService - update README and docs testing/source-map sections
This commit is contained in:
@@ -28,15 +28,7 @@ Impact:
|
||||
|
||||
- log output may indicate startup intent, but process is not actually launched via that path
|
||||
|
||||
## 4. Legacy Mockito Dependency
|
||||
|
||||
Mockito-based tests fail on Java 17 due to old `mockito-all:2.0.2-beta`.
|
||||
|
||||
Impact:
|
||||
|
||||
- full CI-style green test run is blocked until dependency modernization
|
||||
|
||||
## 5. Encoding Artifacts in Logs/Strings
|
||||
## 4. Encoding Artifacts in Logs/Strings
|
||||
|
||||
Some source/log text contains mojibake characters in comments/messages.
|
||||
|
||||
|
||||
@@ -51,9 +51,16 @@ Package-level map of all Java source files in `src/main/java` and tests in `src/
|
||||
|
||||
## Test Sources
|
||||
|
||||
### `vassistent.model`
|
||||
|
||||
- `AppStateTest.java`
|
||||
|
||||
### `vassistent.service`
|
||||
|
||||
- `AnimationFileServiceTest.java`
|
||||
- `BinaryEventServiceTest.java`
|
||||
- `DataPersistenceServiceTest.java`
|
||||
- `EvaluationServiceTest.java`
|
||||
- `MqttClientServiceTest.java`
|
||||
- `ProcessManagerServiceTest.java`
|
||||
- `StatisticsServiceTest.java`
|
||||
|
||||
+27
-23
@@ -8,32 +8,36 @@ mvn test
|
||||
|
||||
## Current Test Suite
|
||||
|
||||
Located in `src/test/java/vassistent/service`:
|
||||
Located in:
|
||||
|
||||
- `BinaryEventServiceTest`
|
||||
- `DataPersistenceServiceTest`
|
||||
- `EvaluationServiceTest`
|
||||
- `StatisticsServiceTest`
|
||||
- `src/test/java/vassistent/model/AppStateTest`
|
||||
- `src/test/java/vassistent/service/AnimationFileServiceTest`
|
||||
- `src/test/java/vassistent/service/BinaryEventServiceTest`
|
||||
- `src/test/java/vassistent/service/DataPersistenceServiceTest`
|
||||
- `src/test/java/vassistent/service/EvaluationServiceTest`
|
||||
- `src/test/java/vassistent/service/MqttClientServiceTest`
|
||||
- `src/test/java/vassistent/service/ProcessManagerServiceTest`
|
||||
- `src/test/java/vassistent/service/StatisticsServiceTest`
|
||||
|
||||
Coverage focus:
|
||||
|
||||
- state change notifications
|
||||
- payload validation and processing flow
|
||||
- level evaluation thresholds
|
||||
- MQTT lifecycle and topic routing
|
||||
- process launch/shutdown command sequencing
|
||||
- animation file output mapping
|
||||
- SQLite persistence behavior
|
||||
- rolling averages and ratio calculations
|
||||
|
||||
## Current Status (Java 17)
|
||||
|
||||
The suite does not fully pass on Java 17 because of legacy Mockito dependency:
|
||||
- full suite passes with `mvn test`
|
||||
- test stack:
|
||||
- `org.junit.jupiter:junit-jupiter`
|
||||
- `org.mockito:mockito-junit-jupiter`
|
||||
|
||||
- project uses `mockito-all:2.0.2-beta`
|
||||
- this version relies on CGLIB behavior that conflicts with modern Java module access
|
||||
- result: Mockito-based tests fail at initialization (`InaccessibleObjectException`)
|
||||
## Notes
|
||||
|
||||
Tests not depending on Mockito are expected to run successfully.
|
||||
|
||||
## Recommended Fix
|
||||
|
||||
Replace legacy dependency with modern Mockito stack, for example:
|
||||
|
||||
- `org.mockito:mockito-core` (or `mockito-junit-jupiter`)
|
||||
- ensure JUnit Jupiter engine is configured by Surefire
|
||||
|
||||
After dependency update, rerun:
|
||||
|
||||
```powershell
|
||||
mvn test
|
||||
```
|
||||
- some tests are integration-style and use temporary SQLite databases
|
||||
- test output may include logger lines because services log during execution
|
||||
|
||||
Reference in New Issue
Block a user