File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed
main/java/rx/internal/operators
test/java/rx/internal/operators Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,14 @@ public final class OnSubscribeFromIterable<T> implements OnSubscribe<T> {
3535 final Iterable <? extends T > is ;
3636
3737 public OnSubscribeFromIterable (Iterable <? extends T > iterable ) {
38+ if (iterable == null ) {
39+ throw new NullPointerException ("iterable must not be null" );
40+ }
3841 this .is = iterable ;
3942 }
4043
4144 @ Override
4245 public void call (final Subscriber <? super T > o ) {
43- if (is == null ) {
44- o .onCompleted ();
45- }
4646 final Iterator <? extends T > it = is .iterator ();
4747 o .setProducer (new IterableProducer <T >(o , it ));
4848 }
Original file line number Diff line number Diff line change 3535
3636public class OnSubscribeFromIterableTest {
3737
38- @ Test
38+ @ Test ( expected = NullPointerException . class )
3939 public void testNull () {
40- Observable <String > observable = Observable .create (new OnSubscribeFromIterable <String >(null ));
41-
42- @ SuppressWarnings ("unchecked" )
43- Observer <String > observer = mock (Observer .class );
44- observable .subscribe (observer );
45- verify (observer , Mockito .never ()).onNext (any (String .class ));
46- verify (observer , Mockito .never ()).onError (any (Throwable .class ));
47- verify (observer , times (1 )).onCompleted ();
40+ Observable .create (new OnSubscribeFromIterable <String >(null ));
4841 }
4942
5043 @ Test
You can’t perform that action at this time.
0 commit comments