KhyatiVaghamshi opened a new pull request, #23381: URL: https://github.com/apache/kafka/pull/23381
## Summary Replace `File.createTempFile()` and `Files.createTempFile()` with JUnit 5 `@TempDir` annotation in three modules: * `CheckerTestUtils.java`, `CheckerUtilsTest.java`, `MetadataSchemaCheckerToolTest.java` (generator module) * `ClusterConfigTest.java` (test-common module) * `ProducerPerformanceTest.java` (tools module) This removes the need for manual `deleteOnExit()` calls as JUnit 5 handles temporary directory lifecycle automatically. ## Changes * Updated `CheckerTestUtils.messageSpecStringToTempFile()` to accept a `Path tempDir` parameter instead of using `Files.createTempFile()` * Added `@TempDir private Path tempDir` field to `CheckerUtilsTest` and `MetadataSchemaCheckerToolTest`, updated their calls * Added `@TempDir private Path tempDir` field to `ClusterConfigTest`, replaced `Files.createTempFile()` with `Files.createFile(tempDir.resolve(...))` * Added `@TempDir private Path tempDir` field to `ProducerPerformanceTest`, replaced `File.createTempFile()` with `Files.createFile(tempDir.resolve(...))` in the helper method ## Scope This is a follow-up to #23280 which covered the connect module. This PR covers the three modules with the smallest change footprint (1 occurrence each). Additional modules (clients, remaining connect files) can be migrated in follow-up PRs. ## Test plan * `ProducerPerformanceTest` - all tests pass * `ClusterConfigTest` - all tests pass * `CheckerUtilsTest` - all tests pass * `MetadataSchemaCheckerToolTest` - all tests pass * Verified locally with `./gradlew tools:test --tests ProducerPerformanceTest` * Verified locally with `./gradlew :test-common:test-common-internal-api:test --tests ClusterConfigTest` * Verified locally with `./gradlew generator:test --tests CheckerUtilsTest --tests MetadataSchemaCheckerToolTest` * Checkstyle and Spotless checks pass Reviewers: Uros (github:uros-b) -- 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]
