-
Notifications
You must be signed in to change notification settings - Fork 110
Upgrade to RxJava 1.1.9 and add missing operators #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ import org.mockito.Mockito._ | |
| import org.scalatest.junit.JUnitSuite | ||
| import rx.lang.scala._ | ||
| import rx.lang.scala.schedulers.TestScheduler | ||
| import rx.observers.TestObserver | ||
| import rx.observers.TestSubscriber | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| import rx.lang.scala.JavaConversions._ | ||
|
|
||
| class TestSchedulerExample extends JUnitSuite { | ||
|
|
@@ -34,7 +34,7 @@ class TestSchedulerExample extends JUnitSuite { | |
| val o = Observable.interval(1 second, scheduler) | ||
|
|
||
| // Wrap Java Observer in Scala Observer, then subscribe | ||
| val sub = o.subscribe(toScalaObserver(new TestObserver(observer))) | ||
| val sub = o.subscribe(toScalaSubscriber(new TestSubscriber(observer))) | ||
|
|
||
| verify(observer, never).onNext(0L) | ||
| verify(observer, never).onCompleted() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
| package rx.lang.scala.observers | ||
|
|
||
| import java.util.concurrent.TimeUnit | ||
| import scala.collection.JavaConversions._ | ||
| import scala.collection.JavaConverters._ | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| import scala.concurrent.duration.Duration | ||
| import rx.{Subscriber => JSubscriber, Observer => JObserver, Subscription => JSubscription} | ||
| import rx.annotations.Experimental | ||
|
|
@@ -48,7 +48,7 @@ class TestSubscriber[T] private[scala](jTestSubscriber: JTestSubscriber[T]) exte | |
| * @return a sequence of the `Throwable`s that were passed to the [[Subscriber.onError]] method | ||
| */ | ||
| def getOnErrorEvents: Seq[Throwable] = { | ||
| jTestSubscriber.getOnErrorEvents() | ||
| jTestSubscriber.getOnErrorEvents().asScala | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -57,7 +57,7 @@ class TestSubscriber[T] private[scala](jTestSubscriber: JTestSubscriber[T]) exte | |
| * @return a sequence of items observed by this [[Subscriber]], in the order in which they were observed | ||
| */ | ||
| def getOnNextEvents: Seq[T] = { | ||
| jTestSubscriber.getOnNextEvents() | ||
| jTestSubscriber.getOnNextEvents().asScala | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -259,6 +259,40 @@ class TestSubscriber[T] private[scala](jTestSubscriber: JTestSubscriber[T]) exte | |
| def assertValue(value: T): Unit = { | ||
| jTestSubscriber.assertValue(value) | ||
| } | ||
|
|
||
| /** | ||
| * $experimental Assert that the [[TestSubscriber]] contains the given first and optional rest values exactly | ||
| * and if so, clears the internal list of values. | ||
| * {{{ | ||
| * val ts = TestSubscriber() | ||
| * | ||
| * ts.onNext(1) | ||
| * | ||
| * ts.assertValuesAndClear(1) | ||
| * | ||
| * ts.onNext(2) | ||
| * ts.onNext(3) | ||
| * | ||
| * ts.assertValuesAndClear(2, 3) // no mention of 1 | ||
| * }}} | ||
| * | ||
| * @param expectedFirstValue the expected first value | ||
| * @param expectedRestValues the optional rest values | ||
| */ | ||
| @Experimental | ||
| def assertValuesAndClear(expectedFirstValue: T, expectedRestValues: T*): Unit = { | ||
| jTestSubscriber.assertValuesAndClear(expectedFirstValue, expectedRestValues: _*) | ||
| } | ||
|
|
||
| /** | ||
| * $experimental Returns the number of times onCompleted was called on this [[TestSubscriber]]. | ||
| * | ||
| * @return the number of times onCompleted was called on this [[TestSubscriber]]. | ||
| */ | ||
| @Experimental | ||
| def getCompletions: Int = { | ||
| jTestSubscriber.getCompletions | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 😃