Skip to content

Commit df5dcc1

Browse files
committed
Merge pull request #178 from illusioni/0.x
eliminated two possible false positives from BlockingObservableTest
2 parents c283757 + 2e01a06 commit df5dcc1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/test/scala/rx/lang/scala/observables/BlockingObservableTest.scala

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,23 @@ class BlockingObservableTest extends JUnitSuite {
161161
assertEquals(1, r)
162162
}
163163

164-
@Test(expected = classOf[NoSuchElementException])
164+
@Test
165165
def testToFutureWithEmpty() {
166166
val o = Observable.empty
167-
Await.result(o.toBlocking.toFuture, 10 seconds)
167+
val future = o.toBlocking.toFuture //if this were to throw the original test would wrongly succeed
168+
Await.result(future.failed, 10 seconds) match {
169+
case t:NoSuchElementException => //this is what we expect
170+
case _ => fail("expected the future to fail with a NoSuchElementException")
171+
}
168172
}
169173

170-
@Test(expected = classOf[IllegalArgumentException])
174+
@Test
171175
def testToFutureWithMultipleItems() {
172176
val o = Observable.just(1, 2)
173-
Await.result(o.toBlocking.toFuture, 10 seconds)
177+
val future = o.toBlocking.toFuture //if this were to throw the original test would wrongly succeed
178+
Await.result(future.failed, 10 seconds) match {
179+
case t:IllegalArgumentException => //this is what we expect
180+
case _ => fail("expected the future to fail with an IllegalArgumentException")
181+
}
174182
}
175183
}

0 commit comments

Comments
 (0)