aboutsummaryrefslogtreecommitdiffstats
path: root/utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java
diff options
context:
space:
mode:
Diffstat (limited to 'utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java')
-rw-r--r--utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java26
1 files changed, 12 insertions, 14 deletions
diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java b/utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java
index 0fba944e..06ca8046 100644
--- a/utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java
+++ b/utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java
@@ -2,7 +2,7 @@
* ============LICENSE_START====================================================
* Common Utils-Test
* =============================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018, 2020-2021 AT&T Intellectual Property. All rights reserved.
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@ import static org.junit.Assert.assertTrue;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,7 +39,7 @@ public class ThrowablesTester {
private static Logger logger =
LoggerFactory.getLogger(ThrowablesTester.class);
- public static final String EXPECTED_EXCEPTION_MSG =
+ public static final String EXPECTED_EXCEPTION_MSG =
"expected exception";
private static final String EXPECTED_SUPPRESSED_EXCEPTION_MSG =
"expected suppressed exception";
@@ -74,7 +73,7 @@ public class ThrowablesTester {
*/
public final <T extends Throwable> int testAllThrowable(
final Class<T> claz) {
- int ncons = 0;
+ var ncons = 0;
ncons += testDefault(claz);
ncons += testString(claz);
@@ -113,7 +112,7 @@ public class ThrowablesTester {
return 0;
}
- T ex = newInstance(cons);
+ var ex = newInstance(cons);
assertNotNull(ex.toString());
assertNull(ex.getMessage());
@@ -152,7 +151,7 @@ public class ThrowablesTester {
return 0;
}
- T ex = newInstance(cons, "hello");
+ var ex = newInstance(cons, "hello");
assertNotNull(ex.toString());
assertEquals("hello", ex.getMessage());
@@ -192,7 +191,7 @@ public class ThrowablesTester {
return 0;
}
- T ex = newInstance(cons, CAUSE);
+ var ex = newInstance(cons, CAUSE);
assertEquals(ex.getMessage(), ex.getMessage());
assertNotNull(ex.toString());
@@ -232,7 +231,7 @@ public class ThrowablesTester {
return 0;
}
- T ex = newInstance(cons, "world", CAUSE);
+ var ex = newInstance(cons, "world", CAUSE);
assertNotNull(ex.toString());
assertEquals("world", ex.getMessage());
@@ -383,7 +382,7 @@ public class ThrowablesTester {
*/
public final <T extends Throwable> void testSuppressStack(
final Constructor<T> cons) {
- T ex = newInstance(cons, "yes,yes", CAUSE, true, true);
+ var ex = newInstance(cons, "yes,yes", CAUSE, true, true);
ex.addSuppressed(SUPPRESSED);
@@ -421,7 +420,7 @@ public class ThrowablesTester {
*/
public final <T extends Throwable> void testSuppressNoStack(
final Constructor<T> cons) {
- T ex = newInstance(cons, "yes,no", CAUSE, true, false);
+ var ex = newInstance(cons, "yes,no", CAUSE, true, false);
ex.addSuppressed(SUPPRESSED);
@@ -459,7 +458,7 @@ public class ThrowablesTester {
*/
public final <T extends Throwable> void testNoSuppressStack(
final Constructor<T> cons) {
- T ex = newInstance(cons, "no,yes", CAUSE, false, true);
+ var ex = newInstance(cons, "no,yes", CAUSE, false, true);
ex.addSuppressed(SUPPRESSED);
@@ -495,7 +494,7 @@ public class ThrowablesTester {
*/
public final <T extends Throwable> void testNoSuppressNoStack(
final Constructor<T> cons) {
- T ex = newInstance(cons, "no,no", CAUSE, false, false);
+ var ex = newInstance(cons, "no,no", CAUSE, false, false);
ex.addSuppressed(SUPPRESSED);
@@ -530,8 +529,7 @@ public class ThrowablesTester {
} catch (NoSuchMethodException | SecurityException e) {
// this constructor is not defined so nothing to test
- logger.debug("skipped test, no constructor for: "
- + claz + " due to: " + e);
+ logger.debug("skipped test, no constructor for: {}", claz, e);
return null;
}
}