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> {
35
35
final Iterable <? extends T > is ;
36
36
37
37
public OnSubscribeFromIterable (Iterable <? extends T > iterable ) {
38
+ if (iterable == null ) {
39
+ throw new NullPointerException ("iterable must not be null" );
40
+ }
38
41
this .is = iterable ;
39
42
}
40
43
41
44
@ Override
42
45
public void call (final Subscriber <? super T > o ) {
43
- if (is == null ) {
44
- o .onCompleted ();
45
- }
46
46
final Iterator <? extends T > it = is .iterator ();
47
47
o .setProducer (new IterableProducer <T >(o , it ));
48
48
}
Original file line number Diff line number Diff line change 35
35
36
36
public class OnSubscribeFromIterableTest {
37
37
38
- @ Test
38
+ @ Test ( expected = NullPointerException . class )
39
39
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 ));
48
41
}
49
42
50
43
@ Test
You can’t perform that action at this time.
0 commit comments