All quizzes
Free quiz · 40 questions in the bank

JUnit quiz

Test your JUnit knowledge with a free interactive quiz — 40 questions with answers and explanations. No signup needed to play.

Question 1/5Score 0

What does the @RunWith annotation do on a JUnit 4 test class?

Questions in this quiz
  1. What does the @RunWith annotation do on a JUnit 4 test class?
  2. In Mockito, what does @Mock do when applied to a field in a test class run with MockitoJUnitRunner?
  3. How many instances of a test class does JUnit typically create when running a class with 3 @Test methods?
  4. What is JUnit?
  5. What must be true of methods annotated with @BeforeClass?
  6. What does @Test(expected = IllegalArgumentException.class) do?
  7. What does assertEquals(expected, actual) check?
  8. What is a JUnit 4 test suite (@RunWith(Suite.class) with @Suite.SuiteClasses)?
  9. What is the purpose of the @After annotation?
  10. Which annotation marks a method as a test case in classic JUnit?
  11. What is the effect of assertNotNull(repository.findById(1L))?
  12. Which static class provides JUnit 4's core assertion methods like assertEquals and assertTrue?
Gaps to close?
Read the curated JUnit notes — core concepts, patterns, interview prep.
JUnit notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web