Vishnu Shrikar
12/08/2023, 4:30 AMdeclareMock<Database>(named(InjectableModules.SONG_DATABASE_NAME)) {
justRun { update(any(), any()) }
justRun { add(any()) }
}
YET IT STILL BREAKS
Caused by: java.lang.IllegalStateException: Missing MockProvider. Please use MockProvider.register() to register a new mock provider
WHY is it breaking.Seongil Kim
12/08/2023, 6:14 AMVishnu Shrikar
12/08/2023, 6:31 AMpitpit
10/01/2024, 4:07 PMmockery
i can test with kointest in commonTest with this syntax :
MockProvider.register {
mock<Database>
}
And after I can use declareMock<Database> {
}
But in kotlin multiplatform not equivalent for that :
@get:Rule
_val_ mockProvider = MockProviderRule.create { clazz ->
// Your way to build a Mock here
mockkClass(clazz)
}