This is an automated email from the ASF dual-hosted git repository.

cshannon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/main by this push:
     new 5719e5df2 AMQ-9370 - Improve Openwire marshaller validation test
5719e5df2 is described below

commit 5719e5df2e3cb95b1fb5fe5923bbc3a8d02a27ef
Author: Christopher L. Shannon (cshannon) <[email protected]>
AuthorDate: Thu Oct 26 17:53:41 2023 -0400

    AMQ-9370 - Improve Openwire marshaller validation test
---
 .../activemq/openwire/OpenWireValidationTest.java      | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git 
a/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireValidationTest.java
 
b/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireValidationTest.java
index a7a6a4f7c..e5c7687ee 100644
--- 
a/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireValidationTest.java
+++ 
b/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireValidationTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq.openwire;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.io.DataOutput;
@@ -24,9 +25,12 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.activemq.command.CommandTypes;
 import org.apache.activemq.command.ExceptionResponse;
 import org.apache.activemq.util.ByteSequence;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -40,6 +44,12 @@ import org.junit.runners.Parameterized.Parameters;
 public class OpenWireValidationTest {
 
     protected final int version;
+    private static final AtomicBoolean initialized = new AtomicBoolean(false);
+
+    @Before
+    public void before() {
+        initialized.set(false);
+    }
 
     @Parameters(name = "version={0}")
     public static Collection<Object[]> data() {
@@ -87,11 +97,19 @@ public class OpenWireValidationTest {
 
         assertTrue(response.getException() instanceof 
IllegalArgumentException);
         assertTrue(response.getException().getMessage().contains("is not 
assignable to Throwable"));
+
+        // assert the class was never initialized
+        assertFalse(initialized.get());
     }
 
     static class NotAThrowable {
         private String message;
 
+        static {
+            // Class should not be initialized so set flag here to verify
+            initialized.set(true);
+        }
+
         public NotAThrowable(String message) {
             this.message = message;
         }

Reply via email to