Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test for composite

  • Loading branch information...
commit 998b66a131191f045de5e9cc0d24c524d29800c0 1 parent f2cf497
@jdillon jdillon authored
View
15 common/src/test/java/org/sonatype/sisu/goodies/common/Throwables2Test.java
@@ -18,6 +18,7 @@
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayWithSize;
import static org.hamcrest.Matchers.is;
/**
@@ -69,4 +70,18 @@ public void explainThrowable4() {
log(msg);
assertThat(msg, is("java.lang.RuntimeException: foo, caused by: java.lang.Exception: bar, caused by: java.lang.Exception: baz"));
}
+
+ @Test
+ public void composite() {
+ Throwable foo = new Exception("foo");
+ Throwable bar = new Exception("bar");
+ try {
+ throw Throwables2.composite(new Exception("test"), foo, bar);
+ }
+ catch (Exception e) {
+ assertThat(e.getSuppressed(), arrayWithSize(2));
+ assertThat(e.getSuppressed()[0], is(foo));
+ assertThat(e.getSuppressed()[1], is(bar));
+ }
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.