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

Commit 5385fbf

Browse files
committed
Fixed Mono.name
Signed-off-by: Winarto Zhao <[email protected]>
1 parent a116462 commit 5385fbf

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
package reactor.core.scala.publisher
2020

2121
import java.lang.{Boolean => JBoolean, Iterable => JIterable, Long => JLong}
22-
import java.time.{Duration => JDuration}
2322
import java.util.concurrent.{Callable, CompletableFuture}
24-
import java.util.function.{BiConsumer, BiFunction, BiPredicate, Consumer, Function, Predicate, Supplier}
23+
import java.util.function.{BiPredicate, Consumer, Function, Predicate, Supplier}
2524
import java.util.logging.Level
2625

2726
import org.reactivestreams.{Publisher, Subscriber, Subscription}
28-
import reactor.core.Disposable
29-
import reactor.core.publisher.{MonoProcessor, MonoSink, Signal, SignalType, SynchronousSink, Flux => JFlux, Mono => JMono}
27+
import reactor.core.publisher.{MonoSink, Signal, SignalType, SynchronousSink, Flux => JFlux, Mono => JMono}
28+
import reactor.core.scala.Scannable
3029
import reactor.core.scala.publisher.PimpMyPublisher._
3130
import reactor.core.scheduler.Scheduler
31+
import reactor.core.{Disposable, Scannable => JScannable}
3232
import reactor.util.context.Context
3333
import reactor.util.function._
3434

@@ -63,9 +63,11 @@ import scala.util.{Failure, Success, Try}
6363
* @see Flux
6464
*/
6565
class Mono[T] private(private val jMono: JMono[T])
66-
extends Publisher[T] with MapablePublisher[T] with OnErrorReturn[T] with MonoLike[T] with Filter[T] {
66+
extends Publisher[T] with MapablePublisher[T] with OnErrorReturn[T] with MonoLike[T] with Filter[T] with Scannable {
6767
override def subscribe(s: Subscriber[_ >: T]): Unit = jMono.subscribe(s)
6868

69+
override def jScannable: JScannable = JScannable.from(jMono)
70+
6971
/**
7072
* Transform this [[Mono]] into a target type.
7173
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,7 @@ class FluxTest extends FreeSpec with Matchers with TableDrivenPropertyChecks wit
15741574
.verifyComplete()
15751575
}
15761576

1577-
".name should call the underlying Flux.name method" in {
1577+
".name should name the sequence" in {
15781578
val name = "flux integer"
15791579
val flux = Flux.just(1, 2, 3, 4).name(name)
15801580
val scannable: Scannable = Scannable.from(Option(flux))

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.scalatest.prop.TableDrivenPropertyChecks
1212
import org.scalatest.{AsyncFreeSpec, FreeSpec, Matchers}
1313
import reactor.core.Disposable
1414
import reactor.core.publisher.{BaseSubscriber, Signal, SynchronousSink, Flux => JFlux, Mono => JMono}
15+
import reactor.core.scala.Scannable
1516
import reactor.core.scala.publisher.Mono.just
1617
import reactor.core.scheduler.{Scheduler, Schedulers}
1718
import reactor.test.StepVerifier
@@ -206,11 +207,11 @@ class MonoTest extends FreeSpec with Matchers with TableDrivenPropertyChecks wit
206207
}
207208
}
208209

209-
".name should call the underlying Mono.name method" in {
210-
val jMono = spy(JMono.just(1))
211-
val mono = Mono(jMono)
212-
mono.name("mono-integer")
213-
verify(jMono).name("mono-integer")
210+
".name should name the sequence" in {
211+
val name = "mono integer"
212+
val mono = Mono.just(randomValue).name(name)
213+
val scannable: Scannable = Scannable.from(Option(mono))
214+
scannable.name shouldBe name
214215
}
215216

216217
".never will never signal any data, error or completion signal" in {

0 commit comments

Comments
 (0)