JUnit's extension

It is very important to test the code of an application. Void Framework provides tools for JUnit 5 to run your unit tests in a ready-to-use context as well as with support for Mockito annotations.

To enable this module, just add following lines to the pom.xml file of your project.


JUnit’s extension

The JUnit 5 extension will initialise the Void Framework application and initialise the variables annotated with Mockito annotations. It will also reset the mock between each test. To use it, add the @ExtendWith annotation with the value VoidFrameworkJUnitExtension.class.

Use extra Guice modules

In some situations, you may need to load additional modules for your application to work properly during the unit testing phase. For this, you can use the @ExtraGuiceModule annotation.


@ExtraGuiceModule({ExtraGuiceModule.class, AnotherExtraGuiceModule.class})
final class MySimpleUnitTest {

    private MyRepository myRepository;

    private MyService myService;

    void myLittleTest() {
        // Arrange

        // Act

        // Assert
        Mockito.verify(myRepository, Mockito.times(1)).findAll();