From 1cea85e49ae7659e7124383b619730ba6053bb46 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 4 Sep 2014 14:30:28 +0400 Subject: java-decompiler: optimization (less string buffer allocations on generating text) --- test/org/jetbrains/java/decompiler/SingleClassesTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index f6146c9..9300d78 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -28,11 +28,17 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; public class SingleClassesTest { + private File testDataDir; private File tempDir; private ConsoleDecompiler decompiler; @Before public void setUp() throws IOException { + testDataDir = new File("testData"); + if (!isTestDataDir(testDataDir)) testDataDir = new File("community/plugins/java-decompiler/engine/testData"); + if (!isTestDataDir(testDataDir)) testDataDir = new File("plugins/java-decompiler/engine/testData"); + assertTrue(isTestDataDir(testDataDir)); + //noinspection SSBasedInspection tempDir = File.createTempFile("decompiler_test_", "_dir"); assertTrue(tempDir.delete()); @@ -52,6 +58,7 @@ public class SingleClassesTest { decompiler = null; delete(tempDir); tempDir = null; + testDataDir = null; } @Test public void testClassFields() { doTest("TestClassFields"); } @@ -69,13 +76,9 @@ public class SingleClassesTest { private void doTest(final String testName) { try { - File testDataDir = new File("testData"); - if (!isTestDataDir(testDataDir)) testDataDir = new File("community/plugins/java-decompiler/engine/testData"); - if (!isTestDataDir(testDataDir)) testDataDir = new File("plugins/java-decompiler/engine/testData"); - assertTrue(isTestDataDir(testDataDir)); - File classFile = new File(testDataDir, "/classes/pkg/" + testName + ".class"); assertTrue(classFile.isFile()); + decompiler.addSpace(classFile, true); File[] innerClasses = classFile.getParentFile().listFiles(new FilenameFilter() { @Override -- cgit v1.2.3