Skip to content

Instantly share code, notes, and snippets.

@humblerookie
Created November 30, 2018 07:07
Show Gist options
  • Save humblerookie/cbe4d2acd488d2c074fe708b0be50ff5 to your computer and use it in GitHub Desktop.
Save humblerookie/cbe4d2acd488d2c074fe708b0be50ff5 to your computer and use it in GitHub Desktop.
@RunWith(MockitoJUnitRunner::class)
class DemoViewModelTest {
private var testScheduler = TestScheduler()
@Test
fun testVodoo() {
val subject: PublishSubject<Int> = PublishSubject.create()
val testObserver = subject
.subscribeOn(testScheduler)
.observeOn(testScheduler)
.test()
testScheduler.triggerActions()
subject.onNext(1)
testScheduler.triggerActions()
testObserver.assertValueCount(1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment