You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sv...@apache.org on 2016/10/31 11:12:55 UTC
[5/6] brooklyn-server git commit: Asserts.expectedFailureOfType
requires at least one type
Asserts.expectedFailureOfType requires at least one type
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/124b336a
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/124b336a
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/124b336a
Branch: refs/heads/master
Commit: 124b336aa07c60ae7c06048882f30d64c732d8ec
Parents: a974d3d
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Mon Oct 24 11:43:34 2016 +0100
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Fri Oct 28 14:35:12 2016 +0100
----------------------------------------------------------------------
.../src/main/java/org/apache/brooklyn/test/Asserts.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/124b336a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
index 23624d9..4ea15f0 100644
--- a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
+++ b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
@@ -1211,11 +1211,13 @@ public class Asserts {
* or more usually the test failure of this method is thrown,
* with detail of the original {@link Throwable} logged and included in the caused-by.
*/
- public static void expectedFailureOfType(Throwable e, Class<?> ...permittedSupertypes) {
- if (e instanceof ShouldHaveFailedPreviouslyAssertionError) throw (Error)e;
+ @SuppressWarnings("unchecked")
+ public static void expectedFailureOfType(Throwable e, Class<?> permittedSupertype, Class<?> ...permittedSupertypes) {
+ if (e instanceof ShouldHaveFailedPreviouslyAssertionError) throw (Error) e;
+ Throwable match = Exceptions.getFirstThrowableOfType(e, (Class<? extends Throwable>) permittedSupertype);
+ if (match != null) return;
for (Class<?> clazz: permittedSupertypes) {
- @SuppressWarnings("unchecked")
- Throwable match = Exceptions.getFirstThrowableOfType(e, (Class<? extends Throwable>)clazz);
+ match = Exceptions.getFirstThrowableOfType(e, (Class<? extends Throwable>)clazz);
if (match != null) return;
}
rethrowPreferredException(e,