aaverin
09/14/2018, 2:51 PMfun setup() {
if (!requiresMigration()) {
launch { regularPaymentSetup.setup() }
} else {
launch { migrationPaymentSetup.setup(it) }
}
}
How to unit-test that regularPayment is executed?
launch
starts a new coroutine and test failsJonathan
09/14/2018, 2:56 PMJonathan
09/14/2018, 2:57 PMsuspend fun setup() {
if (!requiresMigration()) {
regularPaymentSetup.setup()
} else {
migrationPaymentSetup.setup(it)
}
}
aaverin
09/14/2018, 2:57 PMJonathan
09/14/2018, 2:57 PMJonathan
09/14/2018, 2:58 PMaaverin
09/14/2018, 2:59 PMfun setup() {
if (!requiresMigration()) {
launch { regularPaymentSetup.setup() }
} else {
reactiveRxCache.load().subscribe {
launch { migrationPaymentSetup.setup(it) }
}
}
}
aaverin
09/14/2018, 2:59 PMJonathan
09/14/2018, 2:59 PMsuspend fun setup() {
if (!requiresMigration()) {
regularPaymentSetup.setup()
} else {
reactiveRxCache.load().consumeEach {
migrationPaymentSetup.setup(it)
}
}
}
Jonathan
09/14/2018, 2:59 PMkotlinx-coroutines-rx2
Jonathan
09/14/2018, 3:00 PMaaverin
09/14/2018, 3:00 PM