mirror of
https://github.com/corda/corda.git
synced 2025-02-25 19:11:45 +00:00
Splitting heartBeat into heartBeatOnNext and heartBeatOnError
This commit is contained in:
parent
f024c7db9e
commit
163beefc0f
@ -317,19 +317,21 @@ class ObservablesTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `throwing FlowSafeSubscriber as a leaf will call onError`() {
|
fun `throwing FlowSafeSubscriber as a leaf will call onError`() {
|
||||||
var heartBeat = 0
|
var heartBeatOnNext = 0
|
||||||
|
var heartBeatOnError = 0
|
||||||
val source = FlowSafeSubject(PublishSubject.create<Int>())
|
val source = FlowSafeSubject(PublishSubject.create<Int>())
|
||||||
// add a leaf FlowSafeSubscriber
|
// add a leaf FlowSafeSubscriber
|
||||||
source.subscribe(/*onNext*/{
|
source.subscribe({
|
||||||
heartBeat++
|
heartBeatOnNext++
|
||||||
throw IllegalStateException()
|
throw IllegalStateException()
|
||||||
},/*onError*/{
|
}, {
|
||||||
heartBeat++
|
heartBeatOnError++
|
||||||
})
|
})
|
||||||
|
|
||||||
source.onNext(1)
|
source.onNext(1)
|
||||||
source.onNext(1)
|
source.onNext(1)
|
||||||
assertEquals(4, heartBeat)
|
assertEquals(2, heartBeatOnNext)
|
||||||
|
assertEquals(2, heartBeatOnError)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user