Skip to content

Commit aa8c7c3

Browse files
mattrjacobsbenjchristensen
authored andcommitted
Added more possible failure cases to CompositeExceptionTest
1 parent cd2f146 commit aa8c7c3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rxjava-core/src/test/java/rx/util/CompositeExceptionTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class CompositeExceptionTest {
3131
private final CompositeException compositeEx;
3232

3333
public CompositeExceptionTest() {
34+
ex1.initCause(ex2);
3435
List<Throwable> throwables = new ArrayList<Throwable>();
3536
throwables.add(ex1);
3637
throwables.add(ex2);
@@ -67,4 +68,12 @@ public void testAttachCallingThreadStackAddCompositeToItself() {
6768
CompositeException.attachCallingThreadStack(compositeEx, compositeEx);
6869
assertEquals(CompositeException.CompositeExceptionCausalChain.MESSAGE, compositeEx.getCause().getMessage());
6970
}
71+
72+
@Test
73+
public void testAttachCallingThreadStackAddExceptionsToEachOther() {
74+
CompositeException.attachCallingThreadStack(ex1, ex2);
75+
CompositeException.attachCallingThreadStack(ex2, ex1);
76+
assertEquals("Ex2", ex1.getCause().getMessage());
77+
assertEquals("Ex1", ex2.getCause().getMessage());
78+
}
7079
}

0 commit comments

Comments
 (0)