https://kotlinlang.org logo
#kotest
Title
# kotest
v

Vishnu Shrikar

12/08/2023, 4:30 AM
so i have a fairly simple piece of code. Nothing to crazy...
Copy code
declareMock<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.
s

Seongil Kim

12/08/2023, 6:14 AM
it looks like koin and mockk’s problem isn’t it? https://github.com/InsertKoinIO/koin/issues/841#issuecomment-653407887
v

Vishnu Shrikar

12/08/2023, 6:31 AM
yes turns out that when you do the registermock you have to do it FIRST or in a beforeeach..