Mockito InjectMocks not working but constructor call does
I'm using Kotlin with Mockito. Given these dependencies: @Mock private lateinit var tokenService: TokenService @Mock private lateinit var jwtDecoder: JwtDecoder @Mock private lateinit var passwordEncoder: PasswordEncoder @Mock private lateinit var authManager: AuthenticationManager @Mock private lateinit var mailLoginUserService: MailLoginUserService @Mock private lateinit var simpleMailService: SimpleMailService I though the following codes should be equivalent. First Variant: @InjectMocks private lateinit var underTest: MailLoginService Second Variant: private lateinit var underTest: MailLoginService @BeforeEach fun setup() { underTest = MailLoginService( tokenService, jwtDecoder, passwordEncoder, authManager, mailLoginUserService, simpleMailService ) } I know that BeforeEach is called before every test giving a knew instanc...