How to test this class:
class A {
val b : B = get()
}
n
Norbi
06/16/2023, 6:27 AM
you should use a primary constructor instead to allow easier testing...
t
Tran An
06/16/2023, 6:28 AM
If it is using the primary constructor then I don't ask this question ...
a
Austin
06/16/2023, 6:32 AM
If you are using GlobalContext, you can use KoinTest extension and set up KoinTestRule. In the KoinTestRule definition, you can prepare modules with mock objects or test objects.
t
Tran An
06/16/2023, 6:49 AM
Thanks, can you give me an example, any url for reference?