title: lateinit property mock object has not been initialized
body: <p>I'm trying to initialize (by mocking) two objects with the annotation @MockBean</p>
  
  <p>It seems only to work if i call the method mock(className), but since i want to use the mocked class on multiple methods i don't want to keep repeating the same code in my test methods.</p>
  
  <p>This is my test class:</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner::class)
  class WordServiceTest {
  
      @MockBean
      lateinit var wordRepositoryMock: WordRepository
  
      @MockBean
      private lateinit var wordMapperMock: WordMapper
  
      @Test
      fun findAllTest() {
          // Error: lateinit property wordRepositoryMock has not been initialized
          val wordService = WordService(wordRepositoryMock, wordMapperMock)
          `when`(wordRepositoryMock.findAll()).thenReturn(listOf(
                  WordEntity(UUID.randomUUID(), "xxx"),
                  WordEntity(UUID.randomUUID(), "xxx")))
          assertEquals(2, wordService.findAll().size)
      }
  
      @Test
      fun wordExistsTest() {
          // This works fine
          val wordRepositoryMock = mock(WordRepository::class.java)
          val wordMapperMock = mock(WordMapper::class.java)
          val wordService = WordService(wordRepositoryMock, wordMapperMock)
          val word = "xxx"
          `when`(wordRepositoryMock.existsWordEntityByName(word)).thenReturn(true)
          assertEquals(true, wordService.wordExists(word))
      }
  }
  </code></pre>
  
  <p>I don't want to use the Spring Boot @Autowired annotation because my spring application requires  contexts which i don't want to load. </p>
  
  <p>The error i'm getting:</p>
  
  <pre><code>lateinit property wordRepositoryMock has not been initialized
  kotlin.UninitializedPropertyAccessException: lateinit property wordRepositoryMock has not been initialized
  </code></pre>
  
  <p>Dependencies:</p>
  
  <pre><code>dependencies {
      ...
      testImplementation("org.springframework.security:spring-security-test")
      testImplementation ('org.springframework.boot:spring-boot-starter-test') 
      testImplementation("org.junit.jupiter:junit-jupiter:5.6.2")
      testImplementation "org.junit.jupiter:junit-jupiter-params:5.5.2"
      testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
      testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2"
      testImplementation("io.rest-assured:spring-mock-mvc:4.0.0")
      testImplementation("io.mockk:mockk:1.9.3")
      testImplementation "org.testcontainers:postgresql:1.11.3"
      testImplementation "org.springframework.kafka:spring-kafka-test:2.2.7.RELEASE"
      runtimeOnly('org.postgresql:postgresql')
      developmentOnly 'org.springframework.boot:spring-boot-devtools'
      testImplementation "org.mockito:mockito-junit-jupiter:3.3.3"
  }
  </code></pre>