I'm using Spring Boot 2.1 with JUnit 5 and just created a test like this:

```
@RunWith(MockitoJUnitRunner.class)
class UserServiceImplTest {

    @Mock
    private AppProperties appProperties;
    @Mock
    private UserAccountService userAccountService;

    @BeforeEach
    void setMockOutput() {
        when(appProperties.getPort()).thenReturn("8088");
        ...
    }

    ...

}

```

The problem is that both variable is null in the `setMockOutput` method even if the `@RunWith(MockitoJUnitRunner.class)` annotation is used on the class as mentioned in other SO questions.

If I create the mocks manually like the code below then it works fine:

```
@RunWith(MockitoJUnitRunner.class)
class UserServiceImplTest {

    private AppProperties appProperties;
    private UserAccountService userAccountService;

    @BeforeEach
    void setMockOutput() {
        appProperties = Mockito.mock(AppProperties.class);
        userAccountService = Mockito.mock(UserAccountService.class);

        when(appProperties.getPort()).thenReturn("8088");
        ...
    }

    ...

}

```