Cleanup (test)
This commit is contained in:
parent
cf72873535
commit
ccd7b93497
@ -21,6 +21,9 @@ import org.junit.Before;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
@ -60,14 +63,7 @@ public class SingleClassesTest {
|
|||||||
assertTrue(classFile.isFile());
|
assertTrue(classFile.isFile());
|
||||||
|
|
||||||
ConsoleDecompiler decompiler = fixture.getDecompiler();
|
ConsoleDecompiler decompiler = fixture.getDecompiler();
|
||||||
decompiler.addSpace(classFile, true);
|
for (File inner : collectClasses(classFile)) {
|
||||||
File[] innerClasses = classFile.getParentFile().listFiles(new FilenameFilter() {
|
|
||||||
@Override
|
|
||||||
public boolean accept(File dir, String name) {
|
|
||||||
return name.matches(testName + "\\$.+\\.class");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
for (File inner : innerClasses) {
|
|
||||||
decompiler.addSpace(inner, true);
|
decompiler.addSpace(inner, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +84,25 @@ public class SingleClassesTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<File> collectClasses(File classFile) {
|
||||||
|
List<File> files = new ArrayList<File>();
|
||||||
|
files.add(classFile);
|
||||||
|
|
||||||
|
File parent = classFile.getParentFile();
|
||||||
|
if (parent != null) {
|
||||||
|
final String pattern = classFile.getName().replace(".class", "") + "\\$.+\\.class";
|
||||||
|
File[] inner = parent.listFiles(new FilenameFilter() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(File dir, String name) {
|
||||||
|
return name.matches(pattern);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (inner != null) Collections.addAll(files, inner);
|
||||||
|
}
|
||||||
|
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
private static String getContent(File file) throws IOException {
|
private static String getContent(File file) throws IOException {
|
||||||
Reader reader = new InputStreamReader(new FileInputStream(file), "UTF-8");
|
Reader reader = new InputStreamReader(new FileInputStream(file), "UTF-8");
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user