chia7712 commented on code in PR #15289: URL: https://github.com/apache/kafka/pull/15289#discussion_r1516374859
########## clients/src/test/java/org/apache/kafka/test/TestUtils.java: ########## @@ -195,6 +195,25 @@ public static File tempDirectory() { return tempDirectory(null); } + /** + * Create a temporary directory under the given root directory. + * The root directory is removed on JVM exit if it doesn't already exist + * when this function is invoked. + * + * @param root path to create temporary directory under + * @return Review Comment: Could you please complete the docs? ########## clients/src/test/java/org/apache/kafka/test/TestUtils.java: ########## @@ -195,6 +195,25 @@ public static File tempDirectory() { return tempDirectory(null); } + /** + * Create a temporary directory under the given root directory. + * The root directory is removed on JVM exit if it doesn't already exist + * when this function is invoked. + * + * @param root path to create temporary directory under + * @return + */ + public static File tempRelativeDir(String root) { + File rootFile = new File(root); + boolean created = rootFile.mkdir(); + + File result = tempDirectory(rootFile.toPath(), null); + if (created) { + rootFile.deleteOnExit(); Review Comment: How about using shorter version: ```java public static File tempRelativeDir(String root) { File rootFile = new File(root); if (rootFile.mkdir()) rootFile.deleteOnExit(); return tempDirectory(rootFile.toPath(), null); } ``` -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org