From 4c606d4368dc5bc3a9c2865119f0c59a3f10308e Mon Sep 17 00:00:00 2001 From: yukei7 Date: Wed, 7 Feb 2024 18:05:06 -0800 Subject: [PATCH] CASSANDRA-19378 skip jacocoInit in JMXStandardsTest --- .../org/apache/cassandra/tools/JMXStandardsTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/unit/org/apache/cassandra/tools/JMXStandardsTest.java b/test/unit/org/apache/cassandra/tools/JMXStandardsTest.java index 87b9ff93fd..c15896b30f 100644 --- a/test/unit/org/apache/cassandra/tools/JMXStandardsTest.java +++ b/test/unit/org/apache/cassandra/tools/JMXStandardsTest.java @@ -27,6 +27,7 @@ import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Map; @@ -111,6 +112,11 @@ public class JMXStandardsTest .add(Exception.class) .build(); + /** + * These are the method names that shouldn't be included in this test + */ + private static final Set IGNORE_METHODS = ImmutableSet.of("$jacocoInit"); + @Test public void interfaces() throws ClassNotFoundException { @@ -127,7 +133,9 @@ public class JMXStandardsTest for (Class klass = Class.forName(className); klass != null && !Object.class.equals(klass); klass = klass.getSuperclass()) { Assertions.assertThat(klass).isInterface(); - Method[] methods = klass.getDeclaredMethods(); + Method[] methods = Arrays.stream(klass.getDeclaredMethods()) + .filter(m -> !IGNORE_METHODS.contains(m.getName())) + .toArray(Method[]::new); for (int i = 0; i < methods.length; i++) { Method method = methods[i];