JUnit 5
JUnit 5 Extensions Model: Writing Custom @ExtendWith Extensions
JUnit 5's extension model replaces @RunWith and @Rule with a single, composable mechanism. You implement one or more callback interfaces—BeforeEachCallback, ParameterResolver, TestExecutionExceptionHandler, and others—register them with @ExtendWith, and JUnit injects them at the right lifecycle points. This post walks through building three real extensions from scratch.