yihua opened a new pull request, #19224: URL: https://github.com/apache/hudi/pull/19224
### Describe the issue this Pull Request addresses Several small, self-contained classes in the `hudi-client` modules (client-common, spark-client, java-client) have little or no direct unit-test coverage: simple enums, exception types, value/POJO holders, config-driven factories, and small utilities. This PR adds focused, cheap unit tests for a batch of these classes so their behavior is pinned and regressions (renames, reordered enum constants, broken selection branches) are caught early. ### Summary and Changelog Adds 12 new test classes covering 15 small classes across the three JVM-side client modules. No production code is changed. Each test asserts real behavior rather than bare instantiation. hudi-client-common: - `TestLockResultEnums` covers `LockGetResult` and `LockUpsertResult`: pins each constant's numeric `getCode()` and the full value set, and verifies `valueOf` round-trips. - `TestAuditOperationState` covers `AuditOperationState`: asserts the declared states and their order, `valueOf` resolution, and rejection of an unknown state. - `TestClientExceptions` covers `HoodieKeyGeneratorException`, `HoodieCompactionException`, and `HoodieRollbackException`: message/cause preservation for both constructor arms and the `HoodieException` type hierarchy. - `TestBucketTypeAndInfo` covers `BucketType` and `BucketInfo`: enum values/`valueOf`, getter values, `equals`/`hashCode` across all fields, and `toString` content. - `TestBloomIndexFileInfo` covers `BloomIndexFileInfo`: both constructors, `hasKeyRanges`, inclusive `isKeyInRange` bounds (and the null-bound guard), and value equality. - `TestClientStatsPojos` covers `SecondaryIndexStats` and `TableWriteStats`: constructor values, setters, equality, the single-arg constructor defaulting metadata stats to empty, and the `isEmptyDataTableWriteStats` branch. - `TestBootstrapPartitionPathTranslators` covers `IdentityBootstrapPartitionPathTranslator` and `DecodedBootstrapPartitionPathTranslator`: identity pass-through vs URI-decoding of an escaped path. - `TestOperationConverter` covers `OperationConverter`: valid enum-name conversion and the unknown-value rejection branch. - `TestBulkInsertSortMode` covers `BulkInsertSortMode`: pins the full ordered constant set (the names double as config values) and case-sensitive `valueOf`. hudi-java-client: - `TestJavaBulkInsertInternalPartitionerFactory` covers `JavaBulkInsertInternalPartitionerFactory`: both supported sort-mode branches select the expected partitioner, and unsupported modes throw. hudi-spark-client: - `TestSparkBucketInfoGetter` covers `ListBasedSparkBucketInfoGetter` and `MapBasedSparkBucketInfoGetter`: positional list lookup (including out-of-range), map lookup by bucket number, and the missing-key null result. - `TestHoodieBloomFilterProbingResult` covers `HoodieBloomFilterProbingResult`: candidate-key accessor, empty set, and value equality. No code was copied. ### Impact Test-only change. No public API, user-facing behavior, or performance impact. ### Risk Level low Tests only; no production code is touched. They exercise existing public behavior with deterministic in-memory inputs and no I/O. ### Documentation Update none ### Contributor's checklist - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [ ] Enough context is provided in the sections above - [ ] Adequate tests were added if applicable -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
