Skip to content
This repository was archived by the owner on Mar 2, 2022. It is now read-only.

Commit 2f75287

Browse files
authored
Merge pull request #28 from rs017991/justOrEmptyNull
Fixed null handling in SMono.justOrEmpty
2 parents 6b03d35 + cc80814 commit 2f75287

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/main/scala/reactor/core/scala/publisher/SMono.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,7 @@ object SMono {
14401440
data match {
14411441
case o: Option[T] => JMono.justOrEmpty[T](o)
14421442
case other: T => JMono.justOrEmpty[T](other)
1443+
case null => JMono.empty[T]()
14431444
}
14441445
}
14451446

src/test/scala/reactor/core/scala/publisher/MonoTest.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ class MonoTest extends FreeSpec with Matchers with TableDrivenPropertyChecks wit
204204
.expectNext(randomValue)
205205
.verifyComplete()
206206
}
207+
"just react on completion signal if it is null" in {
208+
val nullData:Any = null
209+
val mono = Mono.justOrEmpty(nullData)
210+
StepVerifier.create(mono)
211+
.expectComplete()
212+
.verify()
213+
}
207214
}
208215
}
209216

src/test/scala/reactor/core/scala/publisher/SMonoTest.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ class SMonoTest extends FreeSpec with Matchers with TestSupport {
154154
.expectNext(randomValue)
155155
.verifyComplete()
156156
}
157+
"just react on completion signal if it is null" in {
158+
val nullData:Any = null
159+
val mono = SMono.justOrEmpty(nullData)
160+
StepVerifier.create(mono)
161+
.expectComplete()
162+
.verify()
163+
}
157164
}
158165
}
159166

0 commit comments

Comments
 (0)