From 1f3dd43c2dd89d3bd01edd9edf2fb72946e4e447 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Thu, 18 Feb 2016 16:34:37 -0500 Subject: [PATCH] Attach exception messages to JUnit fail() calls Makes failures more informative! Signed-off-by: Alexandre Montplaisir --- .../lttng/ust/agent/integration/context/AppContextITBase.java | 2 +- .../ust/agent/integration/context/AppContextOrderingITBase.java | 2 +- .../java/org/lttng/ust/agent/context/ContextRegistrationIT.java | 2 +- .../lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java | 2 +- .../ust/agent/integration/context/JulAppContextOrderingIT.java | 2 +- .../org/lttng/ust/agent/integration/events/JulLegacyApiIT.java | 2 +- .../agent/integration/filter/JulFilterListenerOrderingIT.java | 2 +- .../agent/integration/context/Log4jAppContextOrderingIT.java | 2 +- .../lttng/ust/agent/integration/events/Log4jLegacyApiIT.java | 2 +- .../agent/integration/filter/Log4jFilterListenerOrderingIT.java | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextITBase.java b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextITBase.java index 65eff8d..695dd04 100644 --- a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextITBase.java +++ b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextITBase.java @@ -69,7 +69,7 @@ public abstract class AppContextITBase { cim = ContextInfoManager.getInstance(); } catch (SecurityException | IOException e) { /* The native library is not available! */ - fail(); + fail(e.getMessage()); } session = ILttngSession.createSession(null, getDomain()); } diff --git a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextOrderingITBase.java b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextOrderingITBase.java index d0acca3..2a2da8e 100644 --- a/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextOrderingITBase.java +++ b/lttng-ust-java-tests-common/src/main/java/org/lttng/ust/agent/integration/context/AppContextOrderingITBase.java @@ -78,7 +78,7 @@ public abstract class AppContextOrderingITBase { cim = ContextInfoManager.getInstance(); } catch (SecurityException | IOException e) { /* The native library is not available! */ - fail(); + fail(e.getMessage()); } session = ILttngSession.createSession(null, getDomain()); } diff --git a/lttng-ust-java-tests-common/src/test/java/org/lttng/ust/agent/context/ContextRegistrationIT.java b/lttng-ust-java-tests-common/src/test/java/org/lttng/ust/agent/context/ContextRegistrationIT.java index 4b8fc2c..8455374 100644 --- a/lttng-ust-java-tests-common/src/test/java/org/lttng/ust/agent/context/ContextRegistrationIT.java +++ b/lttng-ust-java-tests-common/src/test/java/org/lttng/ust/agent/context/ContextRegistrationIT.java @@ -46,7 +46,7 @@ public class ContextRegistrationIT { try { mgr = ContextInfoManager.getInstance(); } catch (SecurityException | IOException e) { - fail(); + fail(e.getMessage()); } } diff --git a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java index a36578b..ddca5e9 100644 --- a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java +++ b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java @@ -66,7 +66,7 @@ public class OldLttngJulHandlerTracingEnabledBenchmark extends JulHandlerBenchma logger.addHandler(agentHandler); } catch (ReflectiveOperationException e) { - fail(); + fail(e.getMessage()); } session = ILttngSession.createSession(null, Domain.JUL); diff --git a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/context/JulAppContextOrderingIT.java b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/context/JulAppContextOrderingIT.java index 1cef0d4..d3a2f64 100644 --- a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/context/JulAppContextOrderingIT.java +++ b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/context/JulAppContextOrderingIT.java @@ -78,7 +78,7 @@ public class JulAppContextOrderingIT extends AppContextOrderingITBase { try { logHandler = new LttngLogHandler(); } catch (SecurityException | IOException e) { - fail(); + fail(e.getMessage()); } logger.addHandler((Handler) logHandler); } diff --git a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java index 9a20f89..35d70ba 100644 --- a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java +++ b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java @@ -183,7 +183,7 @@ public class JulLegacyApiIT { julHandlerField.setAccessible(true); return (ILttngHandler) julHandlerField.get(LTTngAgent.getLTTngAgent()); } catch (ReflectiveOperationException | SecurityException e) { - fail(); + fail(e.getMessage()); return null; } } diff --git a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/filter/JulFilterListenerOrderingIT.java b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/filter/JulFilterListenerOrderingIT.java index e4a81b8..f52b90d 100644 --- a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/filter/JulFilterListenerOrderingIT.java +++ b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/filter/JulFilterListenerOrderingIT.java @@ -66,7 +66,7 @@ public class JulFilterListenerOrderingIT extends FilterListenerOrderingITBase { try { handler = new LttngLogHandler(); } catch (SecurityException | IOException e) { - fail(); + fail(e.getMessage()); } logger.addHandler(handler); } diff --git a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/context/Log4jAppContextOrderingIT.java b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/context/Log4jAppContextOrderingIT.java index 69e45bc..7b69351 100644 --- a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/context/Log4jAppContextOrderingIT.java +++ b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/context/Log4jAppContextOrderingIT.java @@ -78,7 +78,7 @@ public class Log4jAppContextOrderingIT extends AppContextOrderingITBase { try { logHandler = new LttngLogAppender(); } catch (SecurityException | IOException e) { - fail(); + fail(e.getMessage()); } logger.addAppender((Appender) logHandler); } diff --git a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jLegacyApiIT.java b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jLegacyApiIT.java index e6b9a79..fe613d3 100644 --- a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jLegacyApiIT.java +++ b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jLegacyApiIT.java @@ -184,7 +184,7 @@ public class Log4jLegacyApiIT { log4jAppenderField.setAccessible(true); return (ILttngHandler) log4jAppenderField.get(LTTngAgent.getLTTngAgent()); } catch (ReflectiveOperationException | SecurityException e) { - fail(); + fail(e.getMessage()); return null; } } diff --git a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/filter/Log4jFilterListenerOrderingIT.java b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/filter/Log4jFilterListenerOrderingIT.java index e74a5d1..5db9d2b 100644 --- a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/filter/Log4jFilterListenerOrderingIT.java +++ b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/filter/Log4jFilterListenerOrderingIT.java @@ -66,7 +66,7 @@ public class Log4jFilterListenerOrderingIT extends FilterListenerOrderingITBase try { appender = new LttngLogAppender(); } catch (SecurityException | IOException e) { - fail(); + fail(e.getMessage()); } logger.addAppender(appender); } -- 2.34.1