Test generator: improve import statements in generated tests
- delete unused "junit.framework.Assert" import - delete import of the abstract super class, because it always happens to be in the same package - reorder other imports in such way that "Optimize Imports" action in IDEA will mostly have no effect in generated tests. However this will still happen in tests without any nested test cases (useless imports of InnerClasses etc.)
This commit is contained in:
@@ -27,16 +27,11 @@ import org.jetbrains.jet.utils.Printer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
public class TestGenerator {
|
||||
|
||||
private static final List<String> JUNIT3_IMPORTS = Arrays.asList(
|
||||
"junit.framework.Assert",
|
||||
"junit.framework.Test",
|
||||
"junit.framework.TestSuite"
|
||||
);
|
||||
|
||||
private static final Set<String> GENERATED_FILES = ContainerUtil.newHashSet();
|
||||
|
||||
private final String suiteClassPackage;
|
||||
@@ -71,19 +66,14 @@ public class TestGenerator {
|
||||
p.println(FileUtil.loadFile(new File("injector-generator/copyright.txt")));
|
||||
p.println("package ", suiteClassPackage, ";");
|
||||
p.println();
|
||||
for (String importedClassName : JUNIT3_IMPORTS) {
|
||||
p.println("import ", importedClassName, ";");
|
||||
}
|
||||
p.println();
|
||||
|
||||
p.println("import java.io.File;");
|
||||
p.println("import java.util.regex.Pattern;");
|
||||
p.println("import junit.framework.Test;");
|
||||
p.println("import junit.framework.TestSuite;");
|
||||
p.println("import org.jetbrains.jet.JetTestUtils;");
|
||||
p.println("import org.jetbrains.jet.test.InnerTestClasses;");
|
||||
p.println("import org.jetbrains.jet.test.TestMetadata;");
|
||||
p.println();
|
||||
|
||||
p.println("import ", baseTestClassPackage, ".", baseTestClassName, ";");
|
||||
p.println("import java.io.File;");
|
||||
p.println("import java.util.regex.Pattern;");
|
||||
p.println();
|
||||
p.println("/** This class is generated by {@link ", JetTestUtils.TEST_GENERATOR_NAME, "}. DO NOT MODIFY MANUALLY */");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user