Recall & Review
beginner
What is the main architectural difference between JUnit 4 and JUnit 5?
JUnit 4 is a single monolithic framework, while JUnit 5 is modular with three sub-projects: Jupiter (new programming model), Vintage (to run JUnit 3 and 4 tests), and Platform (test engine).
Click to reveal answer
beginner
How do you write a test method in JUnit 5 compared to JUnit 4?
In JUnit 4, use @Test from org.junit.Test. In JUnit 5, use @Test from org.junit.jupiter.api.Test. JUnit 5 supports more flexible annotations and method signatures.
Click to reveal answer
beginner
Which annotation replaces @Before and @After in JUnit 5?
JUnit 5 replaces @Before with @BeforeEach and @After with @AfterEach for better clarity on when methods run.
Click to reveal answer
intermediate
What new features does JUnit 5 provide that JUnit 4 lacks?
JUnit 5 supports dynamic tests, nested tests, improved assertions, better extension model, and parameterized tests with more options.
Click to reveal answer
intermediate
Can JUnit 5 run JUnit 4 tests?
Yes, JUnit 5 includes the Vintage engine to run JUnit 3 and 4 tests, allowing gradual migration.
Click to reveal answer
Which JUnit version introduced the @BeforeEach annotation?
✗ Incorrect
@BeforeEach is a JUnit 5 annotation replacing JUnit 4's @Before.
What is the purpose of the JUnit Vintage engine?
✗ Incorrect
The Vintage engine allows running older JUnit 3 and 4 tests on the JUnit 5 platform.
Which package contains the JUnit 5 @Test annotation?
✗ Incorrect
JUnit 5's @Test annotation is in org.junit.jupiter.api package.
Which feature is new in JUnit 5 compared to JUnit 4?
✗ Incorrect
Dynamic tests are a new feature introduced in JUnit 5.
How does JUnit 5 improve test lifecycle annotations?
✗ Incorrect
JUnit 5 renames lifecycle annotations for clarity and adds new ones like @BeforeEach and @AfterEach.
Explain the modular architecture of JUnit 5 and how it differs from JUnit 4.
Think about how JUnit 5 separates concerns into different parts.
You got /4 concepts.
Describe the key annotation changes from JUnit 4 to JUnit 5 and their benefits.
Focus on lifecycle and test method annotations.
You got /4 concepts.