smolnar82 opened a new pull request, #1225: URL: https://github.com/apache/knox/pull/1225
[KNOX-3317](https://issues.apache.org/jira/browse/KNOX-3317) - Add unit tests for TokenMetadataHeaderHandler ## What changes were proposed in this pull request? This PR introduces comprehensive unit tests for the `TokenMetadataHeaderHandler` class within the `gateway-service-restcatalog` module. Specifically, it adds tests to: - Verify that no `NullPointerException` occurs when the `token-metadata-headers` configuration parameter is missing (null). - Ensure headers are correctly applied to outbound requests based on inbound client credentials and token metadata. - Validate support for custom header prefixes. - Confirm graceful handling of missing metadata items. ## How was this patch tested? The patch was tested by running the newly created unit tests and existing tests in the `gateway-service-restcatalog` module: `mvn -pl gateway-service-restcatalog test` The test suite `TokenMetadataHeaderHandlerTest` includes: - `testNullTokenMetadataHeadersConfig`: Verifies the fix for the NPE. - `testEmptyTokenMetadataHeadersConfig`: Verifies handling of empty configuration strings. - `testApplyHeaders`: Verifies correct mapping of multiple metadata items to headers. - `testApplyHeadersCustomPrefix`: Verifies that custom header prefixes are respected. - `testApplyHeadersMissingMetadata`: Verifies that headers are not added if metadata is missing. ## Integration Tests N/A ## UI changes (None) -- 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]
