Testing / JUnit6 Interview Questions
How do you migrate from JUnit 5 to JUnit 6?
For teams already on JUnit 5.14 and Java 17+, the JUnit team describes the JUnit 6 migration as a "routine dependency bump". The annotation model is unchanged; what breaks is removed APIs and stricter CSV parsing.
<!-- Step 1: Update the BOM version in pom.xml --> <dependencyManagement> <dependencies> <dependency> <groupId>org.junit</groupId> <artifactId>junit-bom</artifactId> <version>6.1.1</version> <!-- was 5.14.x --> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <!-- Step 2: Update Maven Surefire/Failsafe to 3.x --> <!-- (versions older than 3.0.0 are no longer supported by JUnit 6) --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.5.0</version> </plugin> <!-- Gradle: --> // build.gradle.kts dependencies { testImplementation(platform("org.junit:junit-bom:6.1.1")) testImplementation("org.junit.jupiter:junit-jupiter") } tasks.test { useJUnitPlatform() } /* Step 3: Fix compiler errors from removed APIs: - Replace Alphanumeric with MethodName - Remove junit-platform-runner dependency - Remove @RunWith(JUnitPlatform.class) usages - Fix malformed @CsvSource data (extra chars after quotes) - Ensure Java 17+ baseline Step 4: Run the test suite and fix any FastCSV-related failures from stricter CSV parsing */
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...
