473266 - init MultiException cause
This commit is contained in:
parent
7bf6cec74e
commit
3244088565
|
@ -47,7 +47,10 @@ public class MultiException extends Exception
|
|||
throw new IllegalArgumentException();
|
||||
|
||||
if(nested == null)
|
||||
{
|
||||
initCause(e);
|
||||
nested = new ArrayList<>();
|
||||
}
|
||||
|
||||
if (e instanceof MultiException)
|
||||
{
|
||||
|
|
|
@ -148,4 +148,17 @@ public class MultiExceptionTest
|
|||
assertTrue(e.getCause()==me);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCause() throws Exception
|
||||
{
|
||||
MultiException me = new MultiException();
|
||||
IOException io = new IOException("one");
|
||||
RuntimeException run = new RuntimeException("two");
|
||||
me.add(io);
|
||||
me.add(run);
|
||||
|
||||
assertEquals(2,me.size());
|
||||
assertEquals(io,me.getCause());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue