Github user ahgittin commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/1026#discussion_r44742931
--- Diff:
utils/common/src/test/java/org/apache/brooklyn/util/exceptions/ExceptionsTest.java
---
@@ -59,6 +59,28 @@ public void testPropagateCheckedException() throws
Exception {
}
@Test
+ public void testPropagateCheckedExceptionWithMessage() throws
Exception {
+ String extraMsg = "my message";
+ Exception tothrow = new Exception("simulated");
+ try {
+ throw Exceptions.propagate(extraMsg, tothrow);
+ } catch (RuntimeException e) {
+ assertEquals(e.getMessage(), "my message");
+ assertEquals(e.getCause(), tothrow);
+ }
+ }
+
+ @Test
+ public void testPropagateRuntimeExceptionIgnoresMessage() throws
Exception {
+ NullPointerException tothrow = new
NullPointerException("simulated");
+ try {
+ throw Exceptions.propagate("my message", tothrow);
--- End diff --
see `Asserts.shouldHaveFailedPreviously()` (useless in this simple case but
i find it makes this type of test more readable)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---