File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,9 @@ public TestObserver(Observer<T> delegate) {
36
36
this .delegate = delegate ;
37
37
}
38
38
39
+ @ SuppressWarnings ("unchecked" )
39
40
public TestObserver () {
40
- this .delegate = Observers . empty () ;
41
+ this .delegate = ( Observer < T >) INERT ;
41
42
}
42
43
43
44
@ Override
@@ -153,4 +154,23 @@ public void assertTerminalEvent() {
153
154
}
154
155
}
155
156
157
+ // do nothing ... including swallowing errors
158
+ private static Observer <Object > INERT = new Observer <Object >() {
159
+
160
+ @ Override
161
+ public void onCompleted () {
162
+
163
+ }
164
+
165
+ @ Override
166
+ public void onError (Throwable e ) {
167
+
168
+ }
169
+
170
+ @ Override
171
+ public void onNext (Object t ) {
172
+
173
+ }
174
+
175
+ };
156
176
}
Original file line number Diff line number Diff line change @@ -119,5 +119,10 @@ public void testWrappingMockWhenUnsubscribeInvolved() {
119
119
inOrder .verify (mockObserver , times (1 )).onCompleted ();
120
120
inOrder .verifyNoMoreInteractions ();
121
121
}
122
+
123
+ @ Test
124
+ public void testErrorSwallowed () {
125
+ Observable .error (new RuntimeException ()).subscribe (new TestObserver <Object >());
126
+ }
122
127
123
128
}
You can’t perform that action at this time.
0 commit comments