File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
rxjava-core/src/test/java/rx/operators Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -264,29 +264,21 @@ public Integer call(Integer arg0) {
264264 }).toBlockingObservable ().single ();
265265 }
266266
267- @ Test
267+ @ Test ( expected = IllegalArgumentException . class )
268268 public void testMapWithErrorInFuncAndThreadPoolScheduler () throws InterruptedException {
269269 // The error will throw in one of threads in the thread pool.
270270 // If map does not handle it, the error will disappear.
271271 // so map needs to handle the error by itself.
272- final CountDownLatch latch = new CountDownLatch (1 );
273272 Observable <String > m = Observable .from ("one" )
274273 .observeOn (Schedulers .threadPoolForComputation ())
275274 .map (new Func1 <String , String >() {
276275 public String call (String arg0 ) {
277- try {
278- throw new IllegalArgumentException ("any error" );
279- } finally {
280- latch .countDown ();
281- }
276+ throw new IllegalArgumentException ("any error" );
282277 }
283278 });
284279
285- m .subscribe (stringObserver );
286- latch .await ();
287- InOrder inorder = inOrder (stringObserver );
288- inorder .verify (stringObserver , times (1 )).onError (any (IllegalArgumentException .class ));
289- inorder .verifyNoMoreInteractions ();
280+ // block for response, expecting exception thrown
281+ m .toBlockingObservable ().last ();
290282 }
291283
292284 /**
You can’t perform that action at this time.
0 commit comments