raju-balpande commented on code in PR #5556:
URL: https://github.com/apache/ozone/pull/5556#discussion_r1389792798


##########
hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/persistence/AbstractReconSqlDBTest.java:
##########
@@ -36,52 +38,51 @@
 import org.jooq.SQLDialect;
 import org.jooq.impl.DSL;
 import org.jooq.impl.DefaultConfiguration;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.rules.TemporaryFolder;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.google.inject.Module;
 import com.google.inject.Provider;
+import org.junit.jupiter.api.io.TempDir;
 
 /**
  * Class that provides a Recon SQL DB with all the tables created, and APIs
  * to access the DAOs easily.
  */
 public class AbstractReconSqlDBTest {
 
-  @Rule
-  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+  @TempDir
+  protected Path temporaryFolder;
 
   private Injector injector;
   private DSLContext dslContext;
   private Provider<DataSourceConfiguration> configurationProvider;
 
   public AbstractReconSqlDBTest() {
     try {
-      temporaryFolder.create();
+      temporaryFolder = Files.createTempDirectory("JunitConfig");
       configurationProvider =
-          new 
DerbyDataSourceConfigurationProvider(temporaryFolder.newFolder());
+          new DerbyDataSourceConfigurationProvider(Files.createDirectory(
+              temporaryFolder.resolve("Config")).toFile());
     } catch (IOException e) {
-      Assert.fail();
+      Assertions.fail();
     }
   }
 
   protected AbstractReconSqlDBTest(Provider<DataSourceConfiguration> provider) 
{
     try {
-      temporaryFolder.create();
+      temporaryFolder = Files.createTempDirectory("JunitConfig");

Review Comment:
   I checked, the temporary folders been created are not being used by 
subclasses except class TestReconWithDifferentSqlDBs which uses the this 
constructor with parameter provider. May be a refactoring ticket be created to 
address such changes. For now, just because it is inside constructor so will 
need to create the folders.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to