I'm writing some Java code using pattern-matching switch, which requires --enable-preview
to be set in several contexts (compiler, runtime, IDE). At this point, I've got all except one of them: unit tests.
I have these in pom.xml
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>18</source>
<target>18</target>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
</plugin>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
and Maven successfully enables preview for the compiler, but not the unit tests. How do I enable it for junit?