[Test] Add unit tests for RequestBuilder request-code mapping and header field propagation
Description
remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RequestBuilder.java has no direct unit test coverage. The class contains non-trivial public static behavior used to build RPC requests across the codebase:
- request-code-to-header-class lookup (
PullMessageRequestHeader,GetConsumerListByGroupRequestBody,CloneGroupOffsetRequestHeader,QueryConsumerOffsetRequestHeader,UpdateConsumerOffsetRequestHeader), - reflection-based header construction,
oneway/brokerName/topic/queueId/lofield propagation across several overloads (including nullableBooleanqueueId handling),- the unknown-request-code rejection branch (
UnsupportedOperationException).
remoting/src/test/java/org/apache/rocketmq/remoting/rpc/ contains tests for ClientMetadata, RpcClientImpl and RpcRequestHeader, but no test references RequestBuilder anywhere in the repo's test sources. A regression in the request-code mapping or in field propagation would currently go unnoticed.
Expected behavior
Add a focused RequestBuilderTest that pins the current contract: each supported request code returns the expected header type with all fields propagated, and unknown request codes fail with UnsupportedOperationException mentioning the code.
Source: apache/rocketmq