Skip to content

Instantly share code, notes, and snippets.

@davydkov
Last active April 20, 2018 11:17
Show Gist options
  • Save davydkov/173f0348150d28ad22e9c8ed12b82378 to your computer and use it in GitHub Desktop.
Save davydkov/173f0348150d28ad22e9c8ed12b82378 to your computer and use it in GitHub Desktop.
MONIX_VER='3.0.0-RC1'
jar_library(name='monix',
jars=[
scala_jar(org='io.monix', name='monix', rev=MONIX_VER),
scala_jar(org='io.monix', name='monix-eval', rev=MONIX_VER),
scala_jar(org='io.monix', name='monix-reactive', rev=MONIX_VER),
])
jar_library(name='scalatest',
jars=[
scala_jar(org='org.scalatest', name='scalatest', rev='3.0.4')
])
jar_library(name='reactivestreams-test',
jars=[
jar(org='org.reactivestreams', name='reactive-streams-tck', rev='1.0.2')
])
junit_tests(
name='consumer_specs',
sources=['ConsumerReactiveSubscriberSpec.scala'],
dependencies=[
':scalatest',
':reactivestreams-test',
':monix',
]
)
import monix.eval.Callback
import monix.execution.Scheduler
import monix.reactive.Consumer
import org.reactivestreams.Subscriber
import org.reactivestreams.tck.{SubscriberBlackboxVerification, TestEnvironment}
import org.scalatest.testng.TestNGSuiteLike
class ConsumerReactiveSubscriberSpec
extends SubscriberBlackboxVerification[Int](new TestEnvironment(300))
with TestNGSuiteLike {
implicit val scheduler = Scheduler.io()
override def createSubscriber(): Subscriber[Int] = {
Consumer.complete[Int].createSubscriber(Callback.empty, scheduler)._1.toReactive
}
override def createElement(element: Int): Int = element
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment