Testing / JUnit6 Interview Questions
What modules were removed in JUnit 6 and what replaced them?
JUnit 6 removed several modules that had been deprecated across JUnit 5.x releases. Understanding what was removed and what replaced it is important for migration.
| Removed module | What it did | Replacement in JUnit 6 |
|---|---|---|
| junit-platform-runner | JUnit 4 @RunWith(JUnitPlatform.class) runner for running JUnit Platform tests via JUnit 4 infrastructure | Use @Suite and @SelectClasses from junit-platform-suite directly |
| junit-platform-jfr | Provided Java Flight Recorder (JFR) events for test discovery and execution | JFR support is now built into the launcher itself; no separate module needed |
| junit-platform-suite-commons | Internal commons for suite support | Merged into junit-platform-suite-api |
| MethodOrderer.Alphanumeric | Alphabetical test method ordering | Use MethodOrderer.DEFAULT or MethodOrderer.MethodName |
| JUnit Vintage (deprecated) | Runs JUnit 3/4 tests | Still present but deprecated; will be removed in a future major version |
// JUnit 5: @RunWith(JUnitPlatform.class) -- REMOVED @RunWith(JUnitPlatform.class) // Does not exist in JUnit 6 public class MyJUnit4Suite { ... } // JUnit 6: use @Suite directly @Suite @SelectClasses({OrderTest.class, UserTest.class}) public class MyTestSuite { } // JUnit 5: MethodOrderer.Alphanumeric -- REMOVED @TestMethodOrder(MethodOrderer.Alphanumeric.class) // Compile error in JUnit 6 class OldOrderedTest { ... } // JUnit 6: use MethodOrderer.MethodName instead @TestMethodOrder(MethodOrderer.MethodName.class) class OrderedTest { ... } // Check for removed APIs before upgrading: // grep -r "JUnitPlatform\|Alphanumeric\|platform-runner\|platform-jfr" src/
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...
