MaxFreedomPollard opened a new pull request, #23376: URL: https://github.com/apache/kafka/pull/23376
Modernize the seven exception assertions in `DescribeUserScramCredentialsResultTest` from the try/call/fail/catch idiom to `assertThrows`. Each of the old blocks caught a bare `Exception` and asserted nothing about the failure, so a test passed as long as anything at all was thrown. `assertThrows` fails on its own when nothing is thrown and pins the exception type. Every accessor returns a `KafkaFuture`, so the thrown type is `ExecutionException`, and the return value is used to check the cause the result class actually produces: the top-level error handed to `completeExceptionally`, `DuplicateResourceException` from `all()` and `description(failedUser)` when a user result carries `DUPLICATE_RESOURCE`, and `ResourceNotFoundException` from `description(unknownUser)`, both when the user's result carries `RESOURCE_NOT_FOUND` and when the user is absent from the response. Follows the same cleanup as #23277 and #19975. Testing: `:clients:test --tests org.apache.kafka.clients.admin.DescribeUserScramCredentialsResultTest` with Gradle 9.7.1 on Temurin 17, which also runs `checkstyleMain` and `checkstyleTest` for the module, plus `:clients:spotlessCheck`, all green. -- 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]
