Add standalone test coverage for common/'s MiniJson

Requested after MCMapper-Backend's Phase 2: development follows TDD
(test-first) from here on — this retrofits the piece already built
(MiniJson, the hand-rolled JSON codec) before that request landed.

No JUnit/Gradle involved, matching common/'s "must compile standalone
under plain javac" constraint (see README.md) — a hand-rolled assertion
runner in src/test/java, compiled and run via the new run-tests.sh.
Covers write escaping, nested object/array encoding, parsing (including
the exact columns-message shape DefaultBackendConnection actually
builds), and a write-then-parse round-trip.

Deliberately not wired into either leaf's build.gradle sourceSets (which
only pull in src/main/java) — verified both forge-1_12_2 and forge-1_7_10
still compile with src/test/ present, confirming test code doesn't leak
into the shipped mod jar.
This commit is contained in:
2026-08-08 16:39:56 +02:00
parent 2b7e0e090d
commit 53cba762b4
3 changed files with 180 additions and 0 deletions
+17
View File
@@ -17,3 +17,20 @@ Minecraft/Forge/NeoForge API usage — it must compile standalone under plain `j
request/response). Mirrors the WS protocol described in the root plan.
- `config/` — the common config model (backend URL, server token, tracking/reconciliation
intervals) each leaf loads via its own loader-specific config system.
- `json/`, `ws/` — the hand-rolled JSON codec and RFC 6455 WS client `DefaultBackendConnection`
is built on (no third-party dependency, for the same "no shading through legacy ForgeGradle"
reason this module stays dependency-free generally).
## Testing
```
./run-tests.sh
```
Compiles `src/main/java` + `src/test/java` and runs every `*Test.java` class's `main()`. No
JUnit/Gradle — same "must compile standalone under plain `javac`" constraint as the module
itself, and test code never ships in the mod jar so it doesn't need to match either leaf's JDK 8
target. Anything needing a live Forge/Minecraft world (event hook wiring, world reads) isn't
unit-testable this way — those stay integration-tested against a real running
MCMapper-Backend instance instead (see the Phase 1/2 commit messages for how that's been done
so far).