I am trying to test class B's otherWork function but beacuse of its parent class' property I am getting lateinit property p has not been initialized
error
class A{
@Autowired
private lateinit var p:Propery
fun work(){
p.doSomething()
}
}
class B:A{
fun otherWork(){
work()
}
}
@ExtendWith(MockitoExtension::class)
class Test{
@MockkBean
lateinit var p: Property
@BeforeEach
fun setup(){
every { p.doSomething(any()) } returns Unit
}
@Test
fun t(){
/// tests
}
}
The above approach didn't fix the issue. For my test A's work function is unimportant. How can I omit for the test?