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/12Score 0

What is JUnit?

In this round
  1. What is JUnit?
  2. What does @Test(expected = IllegalArgumentException.class) do?
  3. What does verify(inventoryClient, never()).reserve(anyString(), anyInt()) check?
  4. In Mockito, what does @Mock do when applied to a field in a test class run with MockitoJUnitRunner?
  5. What does the @RunWith annotation do on a JUnit 4 test class?
  6. What does assertArrayEquals(new int[]{1, 2, 3}, sortResult) verify?
  7. What must be true of methods annotated with @BeforeClass?
  8. How many instances of a test class does JUnit typically create when running a class with 3 @Test methods?
  9. Which static class provides JUnit 4's core assertion methods like assertEquals and assertTrue?
  10. What is the purpose of the @Before annotation?
  11. Which import is conventionally used to call assertion methods without the "Assert." prefix?
  12. What is a JUnit 4 test suite (@RunWith(Suite.class) with @Suite.SuiteClasses)?
Gaps to close?
Read the curated JUnit notes — core concepts, patterns, interview prep.
JUnit notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web