[java-decompiler] test data cleanup; warnings
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
@@ -104,13 +105,14 @@ public class DecompilerTestFixture {
|
||||
|
||||
public static void assertFilesEqual(File expected, File actual) {
|
||||
if (expected.isDirectory()) {
|
||||
assertThat(actual.list(), Matchers.arrayContainingInAnyOrder(expected.list()));
|
||||
for (String name : expected.list()) {
|
||||
String[] children = Objects.requireNonNull(expected.list());
|
||||
assertThat(actual.list(), Matchers.arrayContainingInAnyOrder(children));
|
||||
for (String name : children) {
|
||||
assertFilesEqual(new File(expected, name), new File(actual, name));
|
||||
}
|
||||
}
|
||||
else {
|
||||
assertThat(getContent(actual), Matchers.equalTo(getContent(expected)));
|
||||
assertEquals(getContent(expected), getContent(actual));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ public class SingleClassesTest {
|
||||
}
|
||||
|
||||
@Test public void testClassFields() { doTest("pkg/TestClassFields"); }
|
||||
@Test public void testInterfaceFields() { doTest("pkg/TestInterfaceFields"); }
|
||||
@Test public void testClassLambda() { doTest("pkg/TestClassLambda"); }
|
||||
@Test public void testClassLoop() { doTest("pkg/TestClassLoop"); }
|
||||
@Test public void testClassSwitch() { doTest("pkg/TestClassSwitch"); }
|
||||
@@ -83,9 +84,6 @@ public class SingleClassesTest {
|
||||
@Test public void testMethodReferenceLetterClass() { doTest("pkg/TestMethodReferenceLetterClass"); }
|
||||
@Test public void testMemberAnnotations() { doTest("pkg/TestMemberAnnotations"); }
|
||||
@Test public void testStaticNameClash() { doTest("pkg/TestStaticNameClash"); }
|
||||
@Test public void testInterfaceWithPrimitiveField() { doTest("pkg/TestInterfaceWithPrimitiveField"); }
|
||||
@Test public void testInterfaceWithObjectField() { doTest("pkg/TestInterfaceWithObjectField"); }
|
||||
@Test public void testTestMutableStaticOtherClass() { doTest("pkg/TestMutableStaticOtherClass"); }
|
||||
|
||||
protected void doTest(String testFile, String... companionFiles) {
|
||||
ConsoleDecompiler decompiler = fixture.getDecompiler();
|
||||
@@ -110,7 +108,7 @@ public class SingleClassesTest {
|
||||
File decompiledFile = new File(fixture.getTargetDir(), testName + ".java");
|
||||
assertTrue(decompiledFile.isFile());
|
||||
File referenceFile = new File(fixture.getTestDataDir(), "results/" + testName + ".dec");
|
||||
assertTrue("Expecting " + referenceFile.getAbsolutePath() + " to be a file", referenceFile.isFile());
|
||||
assertTrue(referenceFile.isFile());
|
||||
assertFilesEqual(referenceFile, decompiledFile);
|
||||
}
|
||||
|
||||
@@ -132,4 +130,4 @@ public class SingleClassesTest {
|
||||
|
||||
return files;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user