From 9695291e370dccebe249cebedd6c4c4c61c1d7af Mon Sep 17 00:00:00 2001 From: Ahmed Ashour Date: Fri, 22 Mar 2019 19:00:10 +0100 Subject: [PATCH] test: case for #62 (PR #497) --- .../trycatch/TryAfterDeclaration.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 jadx-core/src/test/java/jadx/tests/integration/trycatch/TryAfterDeclaration.java diff --git a/jadx-core/src/test/java/jadx/tests/integration/trycatch/TryAfterDeclaration.java b/jadx-core/src/test/java/jadx/tests/integration/trycatch/TryAfterDeclaration.java new file mode 100644 index 000000000..264d6c144 --- /dev/null +++ b/jadx-core/src/test/java/jadx/tests/integration/trycatch/TryAfterDeclaration.java @@ -0,0 +1,46 @@ +package jadx.tests.integration.trycatch; + +import static jadx.tests.api.utils.JadxMatchers.containsOne; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import jadx.NotYetImplemented; +import jadx.NotYetImplementedExtension; +import jadx.core.dex.nodes.ClassNode; +import jadx.tests.api.IntegrationTest; + +@ExtendWith(NotYetImplementedExtension.class) +public class TryAfterDeclaration extends IntegrationTest { + + /** + * Issue #62. + */ + @Test + @NotYetImplemented + public void test62() { + ClassNode cls = getClassNode(TestClass.class); + String code = cls.getCode().toString(); + + assertThat(code, containsOne("try {")); + } +} + +class TestClass { + public static void consume() throws IOException { + InputStream bis = null; + try { + bis = new FileInputStream("1.txt"); + while (bis != null) { + System.out.println("c"); + } + } catch (final IOException e) { + } + } +} +