File tree Expand file tree Collapse file tree
autodispose/src/test/java/com/uber/autodispose Expand file tree Collapse file tree Original file line number Diff line number Diff line change 130130 CompositeException ex = errors .takeCompositeException ();
131131 List <Throwable > ce = ex .getExceptions ();
132132 assertThat (ce ).hasSize (2 );
133- assertThat (ce .get (0 )).hasMessage ("Outer" );
134- assertThat (ce .get (1 )).hasMessage ("Inner" );
133+ assertThat (ce .get (0 )).hasMessageThat ()
134+ .isEqualTo ("Outer" );
135+ assertThat (ce .get (1 )).hasMessageThat ()
136+ .isEqualTo ("Inner" );
135137 }
136138
137139 @ Test public void onCompleteThrows () {
160162
161163 assertTrue (o .isDisposed ());
162164
163- assertThat (errors .take ()).isInstanceOf (TestException .class );
165+ assertThat (errors .takeThrowableFromUndeliverableException ()).isInstanceOf (TestException .class );
164166 }
165167
166168 @ Test @ Ignore public void badSourceOnSubscribe () {
Original file line number Diff line number Diff line change 144144 CompositeException ex = errors .takeCompositeException ();
145145 List <Throwable > ce = ex .getExceptions ();
146146 assertThat (ce ).hasSize (2 );
147- assertThat (ce .get (0 )).hasMessage ("Outer" );
148- assertThat (ce .get (1 )).hasMessage ("Inner" );
147+ assertThat (ce .get (0 )).hasMessageThat ()
148+ .isEqualTo ("Outer" );
149+ assertThat (ce .get (1 )).hasMessageThat ()
150+ .isEqualTo ("Inner" );
149151 }
150152
151153 @ Test public void onCompleteThrows () {
177179
178180 assertTrue (o .isDisposed ());
179181
180- assertThat (errors .take ()).isInstanceOf (TestException .class );
182+ assertThat (errors .takeThrowableFromUndeliverableException ()).isInstanceOf (TestException .class );
181183 }
182184
183185 @ Test @ Ignore public void badSourceOnSubscribe () {
Original file line number Diff line number Diff line change 144144 CompositeException ex = errors .takeCompositeException ();
145145 List <Throwable > ce = ex .getExceptions ();
146146 assertThat (ce ).hasSize (2 );
147- assertThat (ce .get (0 )).hasMessage ("Outer" );
148- assertThat (ce .get (1 )).hasMessage ("Inner" );
147+ assertThat (ce .get (0 )).hasMessageThat ()
148+ .isEqualTo ("Outer" );
149+ assertThat (ce .get (1 )).hasMessageThat ()
150+ .isEqualTo ("Inner" );
149151 }
150152
151153 @ Test public void onCompleteThrows () {
177179
178180 assertTrue (o .isDisposed ());
179181
180- assertThat (errors .take ()).isInstanceOf (TestException .class );
182+ assertThat (errors .takeThrowableFromUndeliverableException ()).isInstanceOf (TestException .class );
181183 }
182184
183185 @ Test @ Ignore public void badSourceOnSubscribe () {
Original file line number Diff line number Diff line change 125125 CompositeException ex = errors .takeCompositeException ();
126126 List <Throwable > ce = ex .getExceptions ();
127127 assertThat (ce ).hasSize (2 );
128- assertThat (ce .get (0 )).hasMessage ("Outer" );
129- assertThat (ce .get (1 )).hasMessage ("Inner" );
128+ assertThat (ce .get (0 )).hasMessageThat ()
129+ .isEqualTo ("Outer" );
130+ assertThat (ce .get (1 )).hasMessageThat ()
131+ .isEqualTo ("Inner" );
130132 }
131133
132134 @ Test @ Ignore public void badSourceOnSubscribe () {
Original file line number Diff line number Diff line change @@ -144,8 +144,10 @@ public class LambdaSubscriberTest {
144144 CompositeException ex = errors .takeCompositeException ();
145145 List <Throwable > ce = ex .getExceptions ();
146146 assertThat (ce ).hasSize (2 );
147- assertThat (ce .get (0 )).hasMessage ("Outer" );
148- assertThat (ce .get (1 )).hasMessage ("Inner" );
147+ assertThat (ce .get (0 )).hasMessageThat ()
148+ .isEqualTo ("Outer" );
149+ assertThat (ce .get (1 )).hasMessageThat ()
150+ .isEqualTo ("Inner" );
149151 } finally {
150152 RxJavaPlugins .reset ();
151153 }
@@ -182,7 +184,8 @@ public class LambdaSubscriberTest {
182184
183185 assertTrue (o .isDisposed ());
184186
185- assertThat (errors .take ()).isInstanceOf (TestException .class );
187+ assertThat (errors .takeThrowableFromUndeliverableException ()).isInstanceOf (TestException
188+ .class );
186189 } finally {
187190 RxJavaPlugins .reset ();
188191 }
Original file line number Diff line number Diff line change 11package com .uber .autodispose ;
22
33import io .reactivex .exceptions .CompositeException ;
4+ import io .reactivex .exceptions .UndeliverableException ;
45import io .reactivex .functions .Consumer ;
56import io .reactivex .plugins .RxJavaPlugins ;
67import java .util .ArrayList ;
@@ -51,6 +52,12 @@ public Throwable take() {
5152 return error ;
5253 }
5354
55+ public Throwable takeThrowableFromUndeliverableException () {
56+ Throwable error = take ();
57+ assertThat (error ).isInstanceOf (UndeliverableException .class );
58+ return error .getCause ();
59+ }
60+
5461 public CompositeException takeCompositeException () {
5562 Throwable error = take ();
5663 assertThat (error ).isInstanceOf (CompositeException .class );
You can’t perform that action at this time.
0 commit comments