quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

@TempDir not working when on a field on @QuarkusTest

Open xtaixe opened this issue 4 years ago • 7 comments

Describe the bug Temp dir not being created and set when using @TempDir a field on @QuarkusTest. It works fine as a set up or test method parameter though.

Expected behavior Temp dir is created and set on field.

Actual behavior The field annotated with @TempDir is null

To Reproduce

@QuarkusTest
class MyTest {

    @TempDir
    Path tempDir;

    @Test
    public void defaultConfiguration() {
        System.out.println(tempDir); //Prints null
    }

}

Environment (please complete the following information):

  • Output of uname -a or ver: Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_6
  • Output of java -version:
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment GraalVM CE 20.2.0 (build 11.0.8+10-jvmci-20.2-b03)
OpenJDK 64-Bit Server VM GraalVM CE 20.2.0 (build 11.0.8+10-jvmci-20.2-b03, mixed mode, sharing)
  • Quarkus version or git rev:1.8.1.Final (quickly tested with 1.9.2.Final and got the same result)
  • Build tool (ie. output of mvnw --version or gradlew --version): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)

xtaixe avatar Nov 12 '20 17:11 xtaixe