JUnit
The JUnit extension adds support to use the @Message annotation on your test classes and methods.
Registering the extension with JUnit
In order to integrate Alerticorn with JUnit it must be registered as an JUnit Extension.
The simplest method is to use the @ExtendWith
-annotation from JUnit and include Alerticorn's MessageExtension
-class
there.
Example of extending your test class
@ExtendWith(MessageExtension::class)
class MyTest {
//...
}
FAQ
Using JUnit, do I have to register the extension on each test class?
@ExtendWith
is the easiest option, but you have multiple ways to register the extension.
- If you have a class that all your tests derived from you can add the
@ExtendWith
-annotation there - Alternatively, you can explore JUnit's mechanisms to register extensions automatically.