You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "zjncs (via GitHub)" <gi...@apache.org> on 2026/10/09 02:16:03 UTC

[PR] test(common): pin the instance id boundary helper [rocketmq-dashboard]

zjncs opened a new pull request, #5745:
URL: https://github.com/apache/rocketmq-dashboard/pull/5745

   ### What
   
   `InstanceIds` — the helper carrying numeric instance identifiers across the String API boundary — had no test. This adds `InstanceIdsTest` with 6 tests.
   
   ### What is pinned
   
   - a numeric string parses to its Long (positive, zero, negative);
   - surrounding whitespace is trimmed before parsing;
   - null and blank read as no id;
   - **a malformed id reads as no id and never throws** — a bad id from the wire is a 404-shaped problem, not a 500;
   - `asString` renders null as null rather than the string literal `"null"`, which would flow back into queries as a phantom id;
   - the string round trip is lossless.
   
   ### Verification
   
   - New tests on unmodified code: **6/6 green**, checkstyle clean (`mvn test -Dtest=InstanceIdsTest`).
   - Discriminating mutations on `InstanceIds`, build result verified red each time:
     1. the trim dropped so padded ids fail to parse — red;
     2. the `NumberFormatException` catch removed so malformed ids throw — red;
     3. `asString` rendering null as the literal `"null"` — red.
   - Restored: 6/6 green. Test-only change; no product code touched.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org