Testing / JUnit6 Interview Questions
How does JUnit 6 integrate with Maven and Gradle?
JUnit 6 requires updated build tool versions that support the JUnit Platform. Maven needs Surefire 3.x and Gradle needs 8.x.
<!-- Maven: complete JUnit 6 setup --> <properties> <java.version>17</java.version> <maven.compiler.source>17</maven.compiler.source> <maven.compiler.target>17</maven.compiler.target> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.junit</groupId> <artifactId>junit-bom</artifactId> <version>6.1.1</version> <type>pom</type><scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>3.3.0</version> <!-- 3.x required for JUnit 6 --> </plugin> </plugins> </build>
// Gradle: complete JUnit 6 setup (build.gradle.kts) plugins { java } java { toolchain { languageVersion = JavaLanguageVersion.of(17) } } dependencies { testImplementation(platform("org.junit:junit-bom:6.1.1")) testImplementation("org.junit.jupiter:junit-jupiter") testRuntimeOnly("org.junit.platform:junit-platform-launcher") } tasks.test { useJUnitPlatform() // Required: tells Gradle to use JUnit Platform maxParallelForks = Runtime.getRuntime().availableProcessors() }
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
