Instead of @Autowire MailManager mailManager, you can mock the bean as given below:
import org.springframework.boot.test.mock.mockito.MockBean;
::
::
@MockBean MailManager mailManager;
Also, you can configure @MockBean MailManager mailManager;
separately in the @SpringBootConfiguration
class and initialize like below:
@Autowire MailManager mailManager