You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/07/21 20:58:55 UTC
[activemq-artemis] 33/33: Adding a test with no argument on exception (just to be sure)
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch new-logging
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit 8bfc5ad425aa77043e9f97257c2e7a18c24a66da
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Thu Jul 21 13:51:02 2022 -0400
Adding a test with no argument on exception (just to be sure)
---
.../artemis/logprocessor/SimpleBundle.java | 4 ++++
.../artemis/logprocessor/SimpleBundleTest.java | 23 ++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundle.java b/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundle.java
index a272894162..7f18d3512f 100644
--- a/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundle.java
+++ b/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundle.java
@@ -75,6 +75,10 @@ public interface SimpleBundle {
@LogMessage(id = 15, value = "Long with 5 parameters p{} p{} p{} p{} p{}", level = LogMessage.Level.WARN)
void longParameters(String p1, String p2, String p3, String p4, String p5);
+ @LogMessage(id = 16, value = "An Exceptional example", level = LogMessage.Level.WARN)
+ void onlyException(MyException e);
+
+
@GetLogger
Logger getLogger();
diff --git a/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundleTest.java b/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundleTest.java
index 7d0a1eadf9..9b79db82cf 100644
--- a/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundleTest.java
+++ b/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundleTest.java
@@ -148,6 +148,29 @@ public class SimpleBundleTest {
}
+ @Test
+ public void onlyException() {
+ try {
+ AssertionLoggerHandler.startCapture(false, false);
+
+ SimpleBundle.MESSAGES.onlyException(createMyException("MSG7777"));
+
+ Assert.assertTrue(AssertionLoggerHandler.findText("TST16"));
+ Assert.assertFalse(AssertionLoggerHandler.findText("MSG7777"));
+
+ AssertionLoggerHandler.clear();
+
+ AssertionLoggerHandler.startCapture(false, true);
+ SimpleBundle.MESSAGES.onlyException(createMyException("MSG7777"));
+ Assert.assertTrue(AssertionLoggerHandler.findText("TST16"));
+ Assert.assertTrue(AssertionLoggerHandler.findText("MSG7777"));
+ Assert.assertTrue(AssertionLoggerHandler.findText("createMyException"));
+ } finally {
+ AssertionLoggerHandler.stopCapture();
+ }
+ }
+
+
// I'm doing it on a method just to assert if this method will appear on the stack trace
private MyException createMyException(String message) {
return new MyException(message);