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

Commit abad581

Browse files
committed
Removed unnecessary generic type from the test code
Signed-off-by: Winarto Zhao <[email protected]>
1 parent fbf6bbd commit abad581

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

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

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import java.util.concurrent.atomic.{AtomicBoolean, AtomicInteger, AtomicLong, At
55

66
import org.mockito.{ArgumentMatchersSugar, IdiomaticMockito}
77
import org.reactivestreams.Subscription
8-
import org.scalatest.freespec.{AnyFreeSpec, AsyncFreeSpec}
8+
import org.scalatest.freespec.AnyFreeSpec
99
import org.scalatest.matchers.should.Matchers
1010
import reactor.core.Disposable
1111
import reactor.core.publisher.{BaseSubscriber, Signal, SynchronousSink, Mono => JMono}
@@ -99,7 +99,7 @@ class SMonoTest extends AnyFreeSpec with Matchers with TestSupport with Idiomati
9999

100100
"a future should result Mono that will return the value from the future object" in {
101101
import scala.concurrent.ExecutionContext.Implicits.global
102-
StepVerifier.create(SMono.fromFuture(Future[Long] {
102+
StepVerifier.create(SMono.fromFuture(Future {
103103
randomValue
104104
}))
105105
.expectNext(randomValue)
@@ -183,13 +183,13 @@ class SMonoTest extends AnyFreeSpec with Matchers with TestSupport with Idiomati
183183
.verifyComplete()
184184
}
185185
"emit true when both publisher emit the same value according to the isEqual function" in {
186-
val mono = SMono.sequenceEqual[Int](just(10), just(100), (t1: Int, t2: Int) => t1 % 10 == t2 % 10)
186+
val mono = SMono.sequenceEqual(just(10), just(100), (t1: Int, t2: Int) => t1 % 10 == t2 % 10)
187187
StepVerifier.create(mono)
188188
.expectNext(true)
189189
.verifyComplete()
190190
}
191191
"emit true when both publisher emit the same value according to the isEqual function with bufferSize" in {
192-
val mono = SMono.sequenceEqual[Int](just(10), just(100), (t1: Int, t2: Int) => t1 % 10 == t2 % 10, 2)
192+
val mono = SMono.sequenceEqual(just(10), just(100), (t1: Int, t2: Int) => t1 % 10 == t2 % 10, 2)
193193
StepVerifier.create(mono)
194194
.expectNext(true)
195195
.verifyComplete()
@@ -208,11 +208,13 @@ class SMonoTest extends AnyFreeSpec with Matchers with TestSupport with Idiomati
208208
"of publisher of unit should return when all of the sources has fulfilled" in {
209209
val completed = new ConcurrentHashMap[String, Boolean]()
210210
val mono = SMono.when(Iterable(
211-
just[Unit]({
211+
just({
212212
completed.put("first", true)
213+
()
213214
}),
214-
just[Unit]({
215+
just({
215216
completed.put("second", true)
217+
()
216218
})
217219
))
218220
StepVerifier.create(mono)
@@ -224,11 +226,13 @@ class SMonoTest extends AnyFreeSpec with Matchers with TestSupport with Idiomati
224226

225227
"with varargs of publisher should return when all of the resources has fulfilled" in {
226228
val completed = new ConcurrentHashMap[String, Boolean]()
227-
val sources = Seq(just[Unit]({
229+
val sources = Seq(just({
228230
completed.put("first", true)
231+
()
229232
}),
230233
just[Unit]({
231234
completed.put("second", true)
235+
()
232236
})
233237
)
234238
StepVerifier.create(SMono.when(sources.toArray: _*))
@@ -258,7 +262,7 @@ class SMonoTest extends AnyFreeSpec with Matchers with TestSupport with Idiomati
258262
}
259263

260264
"with p1, p2, p3, p4 and p5 should merge when all Monos are fulfilled" in {
261-
StepVerifier.create(SMono.zipDelayError(just[Int](1), just(2), just(3), just(4), just(5)))
265+
StepVerifier.create(SMono.zipDelayError(just(1), just(2), just(3), just(4), just(5)))
262266
.expectNext((1, 2, 3, 4, 5))
263267
.verifyComplete()
264268
}
@@ -273,10 +277,10 @@ class SMonoTest extends AnyFreeSpec with Matchers with TestSupport with Idiomati
273277
"of publisher of unit should return when all of the sources has fulfilled" in {
274278
val completed = new ConcurrentHashMap[String, Boolean]()
275279
val mono = SMono.whenDelayError(Iterable(
276-
just[Unit]({
280+
just({
277281
completed.put("first", true)
278282
}),
279-
just[Unit]({
283+
just({
280284
completed.put("second", true)
281285
})
282286
))
@@ -414,13 +418,13 @@ class SMonoTest extends AnyFreeSpec with Matchers with TestSupport with Idiomati
414418
jMono.cancelOn(any[Scheduler]) was called
415419
}
416420

417-
".compose should defer creating the target mono type" in {
421+
".compose (deprecated) should defer creating the target mono type" in {
418422
StepVerifier.create(just(1).compose[String](m => SFlux.fromPublisher(m.map(_.toString))))
419423
.expectNext("1")
420424
.verifyComplete()
421425
}
422426
".transformDeferred should defer creating the target mono type" in {
423-
StepVerifier.create(SMono.just(1).transformDeferred[String](m => SFlux.fromPublisher(m.map(_.toString))))
427+
StepVerifier.create(SMono.just(1).transformDeferred(m => SFlux.fromPublisher(m.map(_.toString))))
424428
.expectNext("1")
425429
.verifyComplete()
426430
}
@@ -440,7 +444,7 @@ class SMonoTest extends AnyFreeSpec with Matchers with TestSupport with Idiomati
440444
}
441445

442446
".defaultIfEmpty should use the provided default value if the mono is empty" in {
443-
StepVerifier.create(SMono.empty[Int].defaultIfEmpty(-1))
447+
StepVerifier.create(SMono.empty.defaultIfEmpty(-1))
444448
.expectNext(-1)
445449
.verifyComplete()
446450
}
@@ -495,7 +499,7 @@ class SMonoTest extends AnyFreeSpec with Matchers with TestSupport with Idiomati
495499
.verifyComplete()
496500
}
497501

498-
".doAfterSuccessOrError should call the callback function after the mono is terminated" in {
502+
".doAfterSuccessOrError (deprecated) should call the callback function after the mono is terminated" in {
499503
val atomicBoolean = new AtomicBoolean(false)
500504
StepVerifier.create(just(randomValue)
501505
.doAfterSuccessOrError { t =>

0 commit comments

Comments
 (0)