According to documentation it is perfectly legal to return null from the supplier in a supplier-backed mono. This results in an empty mono. When we chain that with the single() operator the latter doesn't enforce a single value from the upstream mono by emitting an error, but instead simply relays the complete signal downstream.
According to documentation it is perfectly legal to return
null
from the supplier in a supplier-backed mono. This results in an empty mono. When we chain that with thesingle()
operator the latter doesn't enforce a single value from the upstream mono by emitting an error, but instead simply relays the complete signal downstream.Expected Behavior
Mono.fromSupplier(() -> null).single()
emitsNoSuchElementException
error.Actual Behavior
Mono.fromSupplier(() -> null).single()
completes.Steps to Reproduce
Possible Solution
It seems there's some kind of incorrect internal reaction between the two operators, as sliding
hide()
between them fixes behavior.Your Environment
java -version
): 1.8.0_242uname -a
): Win10