DomGarguilo opened a new pull request #2534:
URL: https://github.com/apache/accumulo/pull/2534


   It looks like the new JUnit 5 `@Tempdir` does not behave quite how I thought 
it did. In the tests that we use `@Tempdir`, we specify a parent directory 
where we want the new directory to be created as well as a name for the new 
directory. However after some testing it looks like these parameters don't make 
a difference in where the directory is actually created or what it is named.
   
   Here is a quick example to illustrate this point:
   ```java
     @TempDir
     private static File tempdir = new File(System.getProperty("user.dir") + 
"/target", "FooBarClassname/");
   
     @TempDir
     private static File tempdir1 = new File(System.getProperty("user.dir") + 
"/target");
   
     @TempDir
     private static File tempdir2 = new File("");
   
     @TempDir
     private static File tempdir3;
   
     @BeforeAll
     public static void setup() throws Exception {
       log.debug("Tempdir : {}", tempdir.getAbsolutePath());
       log.debug("Tempdir1: {}", tempdir1.getAbsolutePath());
       log.debug("Tempdir2: {}", tempdir2.getAbsolutePath());
       log.debug("Tempdir3: {}", tempdir3.getAbsolutePath());
     }
   ```
   this yields:
   ```
   DEBUG: Tempdir : 
/home/dgarguilo/github/accumulo/test/target/junit13744458181439768791
   DEBUG: Tempdir1: 
/home/dgarguilo/github/accumulo/test/target/junit3179925728963842725
   DEBUG: Tempdir2: 
/home/dgarguilo/github/accumulo/test/target/junit4772587255279214508
   DEBUG: Tempdir3: 
/home/dgarguilo/github/accumulo/test/target/junit2922176067888214114
   ```
   
   I don't think this should affect the functionality of the tests but since 
all of the examples produce the same result, it might be best if we replace all 
instances of `@Tempdir` with the shortest code that still produces the same 
result (which would be `tempdir3` in the example).
   
   The tests pass before and after these changes.


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


Reply via email to