You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/06/17 11:30:43 UTC

[commons-bcel] 03/03: Test BCEL-368

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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit ffdad2d0e2fd4187db556b88267a80ac3f4bb1f1
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Sat Jun 17 07:30:36 2023 -0400

    Test BCEL-368
---
 .../org/apache/bcel/classfile/TestJira368.java     |  60 +++++++++++++++++++++
 src/test/resources/jira368/Test.class              | Bin 0 -> 162 bytes
 2 files changed, 60 insertions(+)

diff --git a/src/test/java/org/apache/bcel/classfile/TestJira368.java b/src/test/java/org/apache/bcel/classfile/TestJira368.java
new file mode 100644
index 00000000..f3491d7f
--- /dev/null
+++ b/src/test/java/org/apache/bcel/classfile/TestJira368.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.bcel.classfile;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+import java.io.IOException;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests BCEL-368.
+ */
+public class TestJira368 {
+
+    private JavaClass parseJavaClass() throws IOException {
+        return new ClassParser("src/test/resources/jira368/Test.class").parse();
+    }
+
+    @Test
+    public void testMethodCodeStringBrief() throws Exception {
+        for (Method method : parseJavaClass().getMethods()) {
+            final String string = method.getCode().toString(false);
+            // System.out.println(string);
+            assertNotNull(string);
+        }
+    }
+
+    @Test
+    public void testMethodCodeStringVerbose() throws Exception {
+        for (Method method : parseJavaClass().getMethods()) {
+            final String string = method.getCode().toString(true);
+            // System.out.println(string);
+            assertNotNull(string);
+        }
+    }
+
+    @Test
+    public void testMethodSignature() throws Exception {
+        final String string = parseJavaClass().toString();
+        // System.out.println(string);
+        assertNotNull(string);
+    }
+
+}
diff --git a/src/test/resources/jira368/Test.class b/src/test/resources/jira368/Test.class
new file mode 100644
index 00000000..2f5ce45c
Binary files /dev/null and b/src/test/resources/jira368/Test.class differ