Sobes.tech
Junior — Middle

Can you name key annotations used in JUnit for organizing tests?

sobes.tech AI

Answer from AI

In JUnit, the following key annotations are used to organize tests:

  • @Test — marks a method as a test.
  • @BeforeEach — a method that runs before each test (initialization).
  • @AfterEach — a method that runs after each test (cleanup).
  • @BeforeAll — a method that runs once before all tests in the class (static).
  • @AfterAll — a method that runs once after all tests in the class (static).
  • @Disabled — disables a test so it does not run.

These annotations help structure tests, manage setup and cleanup of the environment for each test or the entire test suite.

Can you name key annotations used in JUnit for… - sobes.tech