@Override inserted

This commit is contained in:
Alexey Kudravtsev
2010-09-30 10:35:35 +04:00
parent 8a170c9ec6
commit 3ca2e87063
103 changed files with 247 additions and 0 deletions
@@ -38,6 +38,7 @@ public abstract class BaseParseTestcase extends TestCase {
PlatformTestCase.initPlatformLangPrefix();
}
@Override
protected void setUp() throws Exception {
super.setUp();
final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
@@ -50,6 +51,7 @@ public abstract class BaseParseTestcase extends TestCase {
final Project project = myFixture.getProject();
new WriteCommandAction(project) {
@Override
protected void run(Result result) throws Throwable {
FileTypeManager.getInstance().registerFileType(RegExpFileType.INSTANCE, new String[]{"regexp"});
}
@@ -57,6 +59,7 @@ public abstract class BaseParseTestcase extends TestCase {
}
@Override
protected void tearDown() throws Exception {
myFixture.tearDown();
myFixture = null;
@@ -49,6 +49,7 @@ public class MainParseTest extends BaseParseTestcase {
private final Map<String, Test> myMap = new LinkedHashMap<String, Test>();
@Override
protected void setUp() throws Exception {
final Document document = new SAXBuilder().build(new File(getTestDataRoot(), "/RETest.xml"));
final List<Element> list = XPath.selectNodes(document.getRootElement(), "//test");
@@ -95,6 +96,7 @@ public class MainParseTest extends BaseParseTestcase {
System.setErr(new PrintStream(myOut));
}
@Override
protected String getTestDataPath() {
return super.getTestDataPath()+"/gen/";
}
@@ -11,10 +11,12 @@ import org.jetbrains.annotations.NonNls;
*/
public abstract class IGInspectionTestCase extends InspectionTestCase {
@Override
protected String getTestDataPath() {
return PluginPathManager.getPluginHomePath("InspectionGadgets") + "/test";
}
@Override
public void doTest(@NonNls final String folderName, final LocalInspectionTool tool) throws Exception {
super.doTest(folderName, new LocalInspectionToolWrapper(tool), "java 1.5");
}
@@ -35,6 +35,7 @@ public class CastConflictsWithInstanceofFixesTest extends IGQuickFixesTestCase {
doTest("replaceInstanceOf", "Replace instanceof");
}
@Override
protected String getRelativePath() {
return "bugs/castconflicts";
}
@@ -32,6 +32,7 @@ public class StaticInheritanceTest extends LightQuickFixTestCase {
doAllTests();
}
@Override
protected String getBasePath() {
return "/com/siyeh/igtest/inheritance/staticInheritance/";
}
@@ -31,10 +31,12 @@ import java.util.List;
public class AntCompletionTest extends LightCodeInsightTestCase {
@Override
protected String getTestDataPath() {
return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/completion/";
}
@Override
protected void configureByFile(@TestDataFile @NonNls String filePath) throws Exception {
super.configureByFile(filePath);
AntSupport.markFileAsAntFile(myVFile, myFile.getProject(), true);
@@ -209,6 +211,7 @@ public class AntCompletionTest extends LightCodeInsightTestCase {
return list.toArray(new LookupElement[list.size()]);
}
@Override
protected void tearDown() throws Exception {
LookupManager.getInstance(getProject()).hideActiveLookup();
super.tearDown();
@@ -55,6 +55,7 @@ public class AntHighlightingTest extends DaemonAnalyzerTestCase {
doTest(getTestName(lowercaseFirstLetter) + ".xml", false, false);
}
@Override
protected void configureByFile(@TestDataFile @NonNls String filePath) throws Exception {
super.configureByFile(filePath);
AntSupport.markFileAsAntFile(myFile.getVirtualFile(), myFile.getProject(), true);
@@ -110,6 +111,7 @@ public class AntHighlightingTest extends DaemonAnalyzerTestCase {
try {
myIgnoreInfos = true;
IdeaTestUtil.assertTiming("Should be quite performant !", 3500, new Runnable() {
@Override
public void run() {
doDoTest(true, false);
}
@@ -121,6 +123,7 @@ public class AntHighlightingTest extends DaemonAnalyzerTestCase {
}
@Override
protected List<HighlightInfo> doHighlighting() {
final List<HighlightInfo> infos = super.doHighlighting();
if (!myIgnoreInfos) {
@@ -129,6 +132,7 @@ public class AntHighlightingTest extends DaemonAnalyzerTestCase {
return Collections.emptyList();
}
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
return new LocalInspectionTool[]{new AntDuplicateTargetsInspection(), new AntResolveInspection()};
}
@@ -65,6 +65,7 @@ public class AntMultiFileCompletionTest extends TestCase {
myFixture.testCompletion(fileNames, initialTest + "_after." + ext);
}
@Override
protected void setUp() throws Exception {
super.setUp();
final JavaTestFixtureFactory fixtureFactory = JavaTestFixtureFactory.getFixtureFactory();
@@ -74,6 +75,7 @@ public class AntMultiFileCompletionTest extends TestCase {
myFixture.setUp();
}
@Override
protected void tearDown() throws Exception {
myFixture.tearDown();
myFixture = null;
@@ -26,6 +26,7 @@ public class AntParsingTest extends ParsingTestCase {
super("", "ant");
}
@Override
protected String getTestDataPath() {
return PluginPathManager.getPluginHomePath("ant") + "/tests/data";
}
@@ -77,15 +77,18 @@ public class AntPropertyExpansionTest extends TestCase{
myMap = map;
}
@Override
@NotNull
public Iterator<String> getNamesIterator() {
return myMap.keySet().iterator();
}
@Override
public String getPropertyValue(String propertyName) {
return myMap.get(propertyName);
}
@Override
public PsiElement getNavigationElement(String propertyName) {
return null;
}
@@ -128,6 +128,7 @@ public class AntRenameTest extends LightCodeInsightTestCase {
doTest();
}
@Override
protected String getTestDataPath() {
return PluginPathManager.getPluginHomePath("ant").replace('\\', '/') + "/tests/data/psi/rename/";
}
@@ -291,6 +291,7 @@ public class AntResolveTest extends ResolveTestCase {
assertTrue(target instanceof PomTargetPsiElement && ((PomTargetPsiElement)target).getTarget().canNavigateToSource());
}
@Override
protected String getTestDataPath() {
return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/resolve/";
}
@@ -39,6 +39,7 @@ public class CustomTypesTest extends ParsingTestCase {
super("", "ant");
}
@Override
protected String getTestDataPath() {
return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/customTypes";
}
@@ -55,12 +56,14 @@ public class CustomTypesTest extends ParsingTestCase {
final Ref<Boolean> found = new Ref<Boolean>(false);
antProject.accept(new AntDomRecursiveVisitor() {
@Override
public void visitAntDomElement(AntDomElement element) {
if (!found.get()) {
super.visitAntDomElement(element);
}
}
@Override
public void visitAntDomCustomElement(AntDomCustomElement element) {
final Class clazz = element.getDefinitionClass();
if (clazz != null && AntCustomTask.class.getName().equals(clazz.getName())) {
@@ -74,6 +77,7 @@ public class CustomTypesTest extends ParsingTestCase {
assertTrue(found.get());
}
@Override
protected String loadFile(String name) throws IOException {
String fullName = getTestDataPath() + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName))).trim();
@@ -45,6 +45,7 @@ public class GenerateAntTest extends IdeaTestCase {
public void testP1() throws Exception {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
final ModifiableRootModel model = ModuleRootManager.getInstance(myModule).getModifiableModel();
final VirtualFile parent = myModule.getModuleFile().getParent();
@@ -107,6 +107,7 @@ public class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
myTempDirFixture.createFile(root +
"/META-INF/plugin.xml", text);
new WriteCommandAction(getProject()) {
@Override
protected void run(Result result) throws Throwable {
PsiTestUtil.addSourceContentToRoots(myModule, myTempDirFixture.getFile(root));
}
@@ -73,6 +73,7 @@ public abstract class Eclipse2ModulesTest extends IdeaTestCase {
final VirtualFile file =
ApplicationManager.getApplication().runWriteAction(
new Computable<VirtualFile>() {
@Override
@Nullable
public VirtualFile compute() {
final VirtualFile baseDir = getProject().getBaseDir();
@@ -88,6 +89,7 @@ public abstract class Eclipse2ModulesTest extends IdeaTestCase {
Assert.assertTrue("File not found", false);
}
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run(){
model.commit();
}
@@ -42,6 +42,7 @@ public class EclipseClasspath2ModulesTest extends Eclipse2ModulesTest {
doTest("multi", "main");
}
@Override
protected void doTest(final String workspaceRoot, final String projectRoot) throws Exception {
super.doTest(workspaceRoot, projectRoot);
EclipseClasspathTest.doTest("/" + workspaceRoot + "/" + projectRoot, getProject());
@@ -80,6 +80,7 @@ public class EclipseClasspathTest extends IdeaTestCase {
}
final Element classpathElement = JDOMUtil.loadDocument(fileText).getRootElement();
final Module module = ApplicationManager.getApplication().runWriteAction(new Computable<Module>() {
@Override
public Module compute() {
return ModuleManager.getInstance(project)
.newModule(path + "/" + EclipseProjectFinder.findProjectName(path) + IdeaXml.IML_EXT, StdModuleTypes.JAVA);
@@ -66,6 +66,7 @@ public class EclipseEmlTest extends IdeaTestCase {
protected static void doTest(String relativePath, final Project project) throws Exception {
final String path = project.getBaseDir().getPath() + relativePath;
final Module module = ApplicationManager.getApplication().runWriteAction(new Computable<Module>() {
@Override
public Module compute() {
return ModuleManager.getInstance(project)
.newModule(path + "/" + EclipseProjectFinder.findProjectName(path) + IdeaXml.IML_EXT, StdModuleTypes.JAVA);
@@ -84,6 +84,7 @@ public class EclipseImlTest extends IdeaTestCase {
fileText = fileText.replaceAll("\\$" + JUNIT + "\\$", communityAppDir);
final Element classpathElement = JDOMUtil.loadDocument(fileText).getRootElement();
final Module module = ApplicationManager.getApplication().runWriteAction(new Computable<Module>() {
@Override
public Module compute() {
return ModuleManager.getInstance(project)
.newModule(new File(path) + File.separator + EclipseProjectFinder
@@ -43,6 +43,7 @@ public class ChangeListManagerUpdateOnFileChangeTest extends GitTestCase {
private ChangeListManagerImpl myChangeListManager;
private VirtualFile afile;
@Override
@BeforeMethod
public void setUp() throws Exception {
super.setUp();
@@ -130,11 +130,13 @@ public class GitHistoryUtilsTestCase extends GitTestCase {
public void testAppendableHistory() throws Exception {
final List<GitFileRevision> revisions = new ArrayList<GitFileRevision>(3);
Consumer<GitFileRevision> consumer = new Consumer<GitFileRevision>() {
@Override
public void consume(GitFileRevision gitFileRevision) {
revisions.add(gitFileRevision);
}
};
Consumer<VcsException> exceptionConsumer = new Consumer<VcsException>() {
@Override
public void consume(VcsException exception) {
fail("No exception expected", exception);
}
@@ -39,6 +39,7 @@ public class GroovyGotoImplementationTest extends JavaCodeInsightFixtureTestCase
dirFixture.setUp();
new WriteCommandAction(getProject()) {
@Override
protected void run(Result result) throws Throwable {
final VirtualFile outside = dirFixture.getFile("").createChildDirectory(this, "outside");
PsiTestUtil.addContentRoot(myModule, outside);
@@ -50,6 +50,7 @@ public class GroovyGotoTest extends LightCodeInsightFixtureTestCase {
public void testNewExpression() throws Throwable {
doTest(new Condition<PsiElement>() {
@Override
public boolean value(PsiElement element) {
return element instanceof GrMethod && ((GrMethod)element).isConstructor() && ((GrMethod)element).getParameters().length == 0;
}
@@ -58,6 +59,7 @@ public class GroovyGotoTest extends LightCodeInsightFixtureTestCase {
public void testNewExpressionWithNamedArgs() throws Throwable {
doTest(new Condition<PsiElement>() {
@Override
public boolean value(PsiElement element) {
return element instanceof PsiClass;
}
@@ -66,6 +68,7 @@ public class GroovyGotoTest extends LightCodeInsightFixtureTestCase {
public void testNewExpressionWithMapParameter() throws Throwable {
doTest(new Condition<PsiElement>() {
@Override
public boolean value(PsiElement element) {
return element instanceof GrMethod && ((GrMethod)element).isConstructor() && ((GrMethod)element).getParameters().length == 1;
}
@@ -74,6 +77,7 @@ public class GroovyGotoTest extends LightCodeInsightFixtureTestCase {
public void testNewExpressionWithAnonymousClass() throws Throwable {
doTest(new Condition<PsiElement>() {
@Override
public boolean value(PsiElement element) {
return element instanceof GrMethod && ((GrMethod)element).isConstructor() && ((GrMethod)element).getParameters().length == 2;
}
@@ -82,6 +86,7 @@ public class GroovyGotoTest extends LightCodeInsightFixtureTestCase {
public void testGroovyDocParameter1() throws Throwable {
doTest(new Condition<PsiElement>() {
@Override
public boolean value(PsiElement element) {
return element instanceof GrParameter && ((GrParameter)element).getName().equals("x");
}
@@ -90,6 +95,7 @@ public class GroovyGotoTest extends LightCodeInsightFixtureTestCase {
public void testGroovyDocParameter2() throws Throwable {
doTest(new Condition<PsiElement>() {
@Override
public boolean value(PsiElement element) {
return element instanceof GrParameter && ((GrParameter)element).getName().equals("x");
}
@@ -38,14 +38,17 @@ import org.jetbrains.plugins.groovy.util.TestUtils;
*/
public abstract class LightGroovyTestCase extends LightCodeInsightFixtureTestCase {
public static final LightProjectDescriptor GROOVY_DESCRIPTOR = new LightProjectDescriptor() {
@Override
public ModuleType getModuleType() {
return StdModuleTypes.JAVA;
}
@Override
public Sdk getSdk() {
return JavaSdkImpl.getMockJdk17("java 1.5");
}
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.getModuleLibraryTable().createLibrary("GROOVY").getModifiableModel();
final VirtualFile groovyJar =
@@ -55,6 +58,7 @@ public abstract class LightGroovyTestCase extends LightCodeInsightFixtureTestCas
}
};
@Override
@NotNull
protected LightProjectDescriptor getProjectDescriptor() {
return GROOVY_DESCRIPTOR;
@@ -66,6 +70,7 @@ public abstract class LightGroovyTestCase extends LightCodeInsightFixtureTestCas
*
* @return relative path to the test data.
*/
@Override
@NonNls
protected abstract String getBasePath();
@@ -66,6 +66,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
CompilerManagerImpl.testSetup();
new WriteCommandAction(getProject()) {
@Override
protected void run(Result result) throws Throwable {
CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(myMainOutput.findOrCreateDir("out").getUrl());
}
@@ -95,6 +96,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
protected void setupTestSources() {
new WriteCommandAction(getProject()) {
@Override
protected void run(Result result) throws Throwable {
final ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule);
final ModifiableRootModel rootModel = rootManager.getModifiableModel();
@@ -134,6 +136,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
protected void deleteClassFile(final String className) throws IOException {
new WriteCommandAction(getProject()) {
@Override
protected void run(Result result) throws Throwable {
final CompilerModuleExtension extension = ModuleRootManager.getInstance(myModule).getModuleExtension(CompilerModuleExtension.class);
//noinspection ConstantConditions
@@ -148,6 +151,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
protected static void setFileText(final PsiFile file, final String barText) throws IOException {
Runnable runnable = new Runnable() {
@Override
public void run() {
try {
VfsUtil.saveText(ObjectUtils.assertNotNull(file.getVirtualFile()), barText);
@@ -163,6 +167,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
protected void setFileName(final PsiFile bar, final String name) {
new WriteCommandAction(getProject()) {
@Override
protected void run(Result result) throws Throwable {
bar.setName(name);
}
@@ -197,8 +202,10 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
semaphore.down();
runner.execute(extension, environment, new ProgramRunner.Callback() {
@Override
public void processStarted(final RunContentDescriptor descriptor) {
Disposer.register(myFixture.getProject(), new Disposable() {
@Override
public void dispose() {
descriptor.dispose();
}
@@ -206,6 +213,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
final ProcessHandler handler = descriptor.getProcessHandler();
assert handler != null;
handler.addProcessListener(new ProcessAdapter() {
@Override
public void onTextAvailable(ProcessEvent event, Key outputType) {
if (ProcessOutputTypes.SYSTEM != outputType) {
sb.append(event.getText());
@@ -232,6 +240,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
mySemaphore = semaphore;
}
@Override
public void finished(boolean aborted, int errors, int warnings, final CompileContext compileContext) {
try {
assertFalse("Code did not compile!", aborted);
@@ -31,6 +31,7 @@ public class GroovyLiveTemplatesTest extends LightCodeInsightFixtureTestCase{
public static void expandTemplate(final Editor editor) {
new WriteCommandAction(editor.getProject()) {
@Override
protected void run(Result result) throws Throwable {
new ListTemplatesAction().actionPerformedImpl(editor.getProject(), editor);
((LookupImpl)LookupManager.getActiveLookup(editor)).finishLookup(Lookup.NORMAL_SELECT_CHAR);
@@ -98,6 +98,7 @@ public class GroovyMoveStatementTest extends LightCodeInsightFixtureTestCase {
final EditorActionHandler handler = EditorActionManager.getInstance().getActionHandler(actionId);
new WriteCommandAction(getProject()) {
@Override
protected void run(Result result) throws Throwable {
final Editor editor = myFixture.getEditor();
handler.execute(editor, DataManager.getInstance().getDataContext(editor.getContentComponent()));
@@ -49,6 +49,7 @@ public abstract class CompletionTestBase extends JavaCodeInsightFixtureTestCase
List<LookupElement> items = lookup.getItems();
if (!addReferenceVariants()) {
items = ContainerUtil.findAll(items, new Condition<LookupElement>() {
@Override
public boolean value(LookupElement lookupElement) {
final Object o = lookupElement.getObject();
return !(o instanceof PsiMember) && !(o instanceof GrVariable);
@@ -56,6 +57,7 @@ public abstract class CompletionTestBase extends JavaCodeInsightFixtureTestCase
});
}
Collections.sort(items, new Comparator<LookupElement>() {
@Override
public int compare(LookupElement o1, LookupElement o2) {
return o1.getLookupString().compareTo(o2.getLookupString());
}
@@ -91,6 +91,7 @@ public class KeywordCompletionTest extends CompletionTestBase {
return TestUtils.getTestDataPath() + "groovy/oldCompletion/keyword";
}
@Override
protected boolean addReferenceVariants() {
return false;
}
@@ -54,6 +54,7 @@ public class ReferenceCompletionTest extends CompletionTestBase {
return TestUtils.getTestDataPath() + "groovy/oldCompletion/reference";
}
@Override
protected boolean addKeywords() {
return false;
}
@@ -34,6 +34,7 @@ public class FormatterTest extends GroovyFormatterTestCase {
return TestUtils.getTestDataPath() + "groovy/formatter/";
}
@Override
protected void setUp() throws Exception {
super.setUp();
myTempSettings.CLASS_BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
@@ -83,8 +83,10 @@ public abstract class GroovyFormatterTestCase extends LightCodeInsightFixtureTes
protected void checkFormatting(String expected) throws IOException {
CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
try {
final PsiFile file = myFixture.getFile();
@@ -22,6 +22,7 @@ public class AllSuperMethodsTest extends OverridingTester {
public void testMethodWithoutParameters() throws Throwable { doTest(); }
public void testMethodWithParameters() throws Throwable { doTest(); }
@Override
PsiMethod[] findMethod(PsiMethod method) {
return method.findSuperMethods();
}
@@ -21,6 +21,7 @@ public class DeepestSuperMethodsTest extends OverridingTester {
return super.getBasePath() + "deepestSuperMethods";
}
@Override
PsiMethod[] findMethod(PsiMethod method) {
return method.findDeepestSuperMethods();
}
@@ -16,6 +16,7 @@ public class PsiEventsTest extends PsiTestCase {
public void testEditingInDocComment() throws Exception {
final Ref<Boolean> gotIt = new Ref<Boolean>(false);
getPsiManager().addPsiTreeChangeListener(new PsiTreeChangeAdapter() {
@Override
public void childReplaced(PsiTreeChangeEvent event) {
gotIt.set(true);
}
@@ -27,8 +28,10 @@ public class PsiEventsTest extends PsiTestCase {
assertNotNull(doc);
CommandProcessor.getInstance().executeCommand(myProject,
new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
doc.insertString(3, " ");
docManager.commitDocument(doc);
@@ -50,6 +50,7 @@ public class SmartEnterTest extends LightCodeInsightFixtureTestCase {
final List<SmartEnterProcessor> processors = getSmartProcessors(GroovyFileType.GROOVY_LANGUAGE);
new WriteCommandAction(getProject()) {
@Override
protected void run(Result result) throws Throwable {
final Editor editor = myFixture.getEditor();
for (SmartEnterProcessor processor : processors) {
@@ -25,6 +25,7 @@ public class ChangeSignatureForJavaTest extends LightCodeInsightFixtureTestCase
public void testGenericTypes() throws Exception {
doTest(null, null, "T", new GenParams() {
@Override
public ParameterInfoImpl[] genParams(PsiMethod method) throws IncorrectOperationException {
final PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
return new ParameterInfoImpl[]{
@@ -37,6 +38,7 @@ public class ChangeSignatureForJavaTest extends LightCodeInsightFixtureTestCase
public void testGenericTypesInOldParameters() throws Exception {
doTest(null, null, null, new GenParams() {
@Override
public ParameterInfoImpl[] genParams(PsiMethod method) throws IncorrectOperationException {
final PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
return new ParameterInfoImpl[] {
@@ -48,6 +50,7 @@ public class ChangeSignatureForJavaTest extends LightCodeInsightFixtureTestCase
public void testTypeParametersInMethod() throws Exception {
doTest(null, null, null, new GenParams() {
@Override
public ParameterInfoImpl[] genParams(PsiMethod method) throws IncorrectOperationException {
final PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
return new ParameterInfoImpl[]{
@@ -195,6 +198,7 @@ public class ChangeSignatureForJavaTest extends LightCodeInsightFixtureTestCase
public void testAddException() throws Exception {
doTest(null, null, null, new SimpleParameterGen(new ParameterInfoImpl[0]),
new GenExceptions() {
@Override
public ThrownExceptionInfo[] genExceptions(PsiMethod method) {
return new ThrownExceptionInfo[] {
new JavaThrownExceptionInfo(-1, JavaPsiFacade.getInstance(method.getProject()).getElementFactory().createTypeByFQClassName("java.lang.Exception", method.getResolveScope()))
@@ -257,6 +261,7 @@ public class ChangeSignatureForJavaTest extends LightCodeInsightFixtureTestCase
myInfos = infos;
}
@Override
public ParameterInfoImpl[] genParams(PsiMethod method) {
for (ParameterInfoImpl info : myInfos) {
info.updateFromMethod(method);
@@ -280,6 +285,7 @@ public class ChangeSignatureForJavaTest extends LightCodeInsightFixtureTestCase
myInfos = infos;
}
@Override
public ThrownExceptionInfo[] genExceptions(PsiMethod method) {
for (ThrownExceptionInfo info : myInfos) {
info.updateFromMethod(method);
@@ -78,6 +78,7 @@ public abstract class ChangeSignatureTestCase extends LightCodeInsightFixtureTes
myProject = project;
}
@Override
public GrParameterInfo[] genParams(GrMethod method) {
GrParameter[] params = method.getParameterList().getParameters();
GrParameterInfo[] result = new GrParameterInfo[myInfos.length];
@@ -136,6 +137,7 @@ public abstract class ChangeSignatureTestCase extends LightCodeInsightFixtureTes
myInfos = infos;
}
@Override
public ThrownExceptionInfo[] genExceptions(PsiMethod method) {
for (ThrownExceptionInfo info : myInfos) {
info.updateFromMethod(method);
@@ -30,6 +30,7 @@ import java.util.Collections;
*/
public class GroovyCopyClassTest extends LightCodeInsightFixtureTestCase {
@Override
protected String getBasePath() {
return TestUtils.getTestDataPath() + "refactoring/copy/";
}
@@ -43,6 +44,7 @@ public class GroovyCopyClassTest extends LightCodeInsightFixtureTestCase {
final PsiClass srcClass = myFixture.getJavaFacade().findClass("foo." + testName, GlobalSearchScope.allScope(getProject()));
assertTrue(CopyClassesHandler.canCopyClass(srcClass));
new WriteCommandAction(getProject()) {
@Override
protected void run(Result result) throws Throwable {
CopyClassesHandler.doCopyClasses(Collections.singletonMap(srcClass.getNavigationElement().getContainingFile(), new PsiClass[]{srcClass}), testName + "_after", srcClass.getManager().findDirectory(myFixture.getTempDirFixture().getFile("bar")),
getProject());
@@ -44,6 +44,7 @@ public class ImplementsExtendsQuickFixTest extends LightCodeInsightFixtureTestCa
newText = "";
} else {
new WriteCommandAction(getProject()) {
@Override
protected void run(Result result) throws Throwable {
ChangeExtendsImplementsQuickFix fix =
new ChangeExtendsImplementsQuickFix(typeDefinition.getExtendsClause(), typeDefinition.getImplementsClause());
@@ -105,6 +105,7 @@ public class InlineMethodTest extends LightCodeInsightFixtureTestCase {
@Override
public Settings prepareInlineElement(PsiElement element, Editor editor, boolean invokedOnReference) {
return new Settings() {
@Override
public boolean isOnlyOneReferenceToInline() {
return false;
}
@@ -105,8 +105,10 @@ public class IntroduceParameterTest extends LightCodeInsightFixtureTestCase {
parametersToRemove);
CommandProcessor.getInstance().executeCommand(project, new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
try {
processor.run();
@@ -46,6 +46,7 @@ import java.util.Comparator;
* @author Maxim.Medvedev
*/
public class GroovyMoveClassTest extends LightCodeInsightFixtureTestCase {
@Override
protected String getBasePath() {
return TestUtils.getTestDataPath() + "refactoring/move/moveClass/";
}
@@ -136,8 +137,10 @@ public class GroovyMoveClassTest extends LightCodeInsightFixtureTestCase {
final Application application = ApplicationManager.getApplication();
CommandProcessor.getInstance().executeCommand(myFixture.getProject(), new Runnable() {
@Override
public void run() {
application.runWriteAction(new Runnable() {
@Override
public void run() {
new MoveClassesOrPackagesProcessor(getProject(), classes, new SingleSourceRootMoveDestination(
PackageWrapper.create(JavaDirectoryService.getInstance().getPackage(dirs[0])), dirs[0]), true, true, null).run();
@@ -168,12 +171,14 @@ public class GroovyMoveClassTest extends LightCodeInsightFixtureTestCase {
final File[] ch1 = d1.listFiles();
final VirtualFile[] ch2 = d2.getChildren();
Arrays.sort(ch1, new Comparator<File>() {
@Override
public int compare(File o1, File o2) {
return o1.getName().compareTo(o2.getName());
}
});
Arrays.sort(ch2, new Comparator<VirtualFile>() {
@Override
public int compare(VirtualFile o1, VirtualFile o2) {
return o1.getName().compareTo(o2.getName());
}
@@ -158,10 +158,12 @@ public class GroovyMoveMembersTest extends LightCodeInsightFixtureTestCase {
this(targetClassName, memberSet.toArray(new PsiMember[memberSet.size()]));
}
@Override
public String getMemberVisibility() {
return myMemberVisibility;
}
@Override
public boolean makeEnumConstant() {
return true;
}
@@ -170,10 +172,12 @@ public class GroovyMoveMembersTest extends LightCodeInsightFixtureTestCase {
myMemberVisibility = visibility;
}
@Override
public PsiMember[] getSelectedMembers() {
return mySelectedMembers;
}
@Override
public String getTargetClassName() {
return myTargetClassName;
}
@@ -36,6 +36,7 @@ import java.io.File;
*/
public class GroovyMoveScriptTest extends LightCodeInsightFixtureTestCase {
@Override
protected String getBasePath() {
return TestUtils.getTestDataPath() + "refactoring/move/moveScript/";
}
@@ -167,6 +167,7 @@ public class OptimizeImportsTest extends LightCodeInsightFixtureTestCase {
final Runnable runnable = optimizer.processFile(myFixture.getFile());
CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().runWriteAction(runnable);
}
@@ -68,6 +68,7 @@ public abstract class FileSetTestCase extends TestSuite {
addAllTests();
}
@Override
public String getName() {
return getClass().getName();
}
@@ -94,20 +95,24 @@ public abstract class FileSetTestCase extends TestSuite {
setName(testFile.getPath());
}
@Override
protected void setUp() throws Exception {
super.setUp();
FileSetTestCase.this.setUp();
}
@Override
protected void tearDown() throws Exception {
FileSetTestCase.this.tearDown();
super.tearDown();
}
@Override
protected void runTest() throws Throwable {
FileSetTestCase.this.runTest(myTestFile);
}
@Override
public int countTestCases() {
return 1;
}
@@ -116,10 +121,12 @@ public abstract class FileSetTestCase extends TestSuite {
return myTestFile.getAbsolutePath() + " ";
}
@Override
protected void resetAllFields() {
// Do nothing otherwise myTestFile will be nulled out before getName() is called.
}
@Override
public String getName() {
return myTestFile.getAbsolutePath();
}
@@ -155,6 +155,7 @@ public class HgUpdateTestCase extends HgFromClonedTestCase {
assertTrue(localChanges.contains(new HgChange(getHgFile(filepath), status)));
}
@Override
protected HgFile getHgFile(String... filepath) {
File fileToInclude = projectRepo;
for (int i = 0; i < filepath.length; i++) {
@@ -22,6 +22,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
* User: Ekaterina Shliakhovetskaja
*/
public class ClassNameWithMistakesInspectionTest extends JavaSpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/classNameWithMistakes";
}
@@ -24,6 +24,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
public class DocCommentWithMistakesInspectionTest extends JavaSpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/docCommentWithMistakes";
}
@@ -24,6 +24,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
public class FieldNameWithMistakesInspectionTest extends JavaSpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/fieldNameWithMistakes";
}
@@ -23,6 +23,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
*/
public class LocalVariableWithMistakesInspectionTest extends JavaSpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/localVariableNameWithMistakes";
}
@@ -23,6 +23,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
*/
public class MethodNameWithMistakesInspectionTest extends JavaSpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/methodNameWithMistakes";
}
@@ -24,6 +24,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
*/
public class StringWithMistakesInspectionTest extends JavaSpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/stringWithMistakes";
}
@@ -202,30 +202,37 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
assertEquals("pom", p.getDependencies().get(0).getExtension());
}
public static class MyArtifactHandler implements ArtifactHandler {
@Override
public String getExtension() {
return "pom";
}
@Override
public String getDirectory() {
throw new UnsupportedOperationException();
}
@Override
public String getClassifier() {
return null;
}
@Override
public String getPackaging() {
return "foo";
}
@Override
public boolean isIncludesDependencies() {
return false;
}
@Override
public String getLanguage() {
return "java";
}
@Override
public boolean isAddedToClasspath() {
return true;
}
@@ -196,35 +196,45 @@ public class NexusIndexerTest extends MavenIndicesTestCase {
}
private static class NullScanningListener implements ArtifactScanningListener {
@Override
public void scanningStarted(IndexingContext indexingContext) {
}
@Override
public void scanningFinished(IndexingContext indexingContext, ScanningResult scanningResult) {
}
@Override
public void artifactError(ArtifactContext artifactContext, Exception e) {
}
@Override
public void artifactDiscovered(ArtifactContext artifactContext) {
}
}
private static class NullTransferListener implements TransferListener {
@Override
public void transferInitiated(TransferEvent event) {
}
@Override
public void transferStarted(TransferEvent event) {
}
@Override
public void transferProgress(TransferEvent event, byte[] bytes, int i) {
}
@Override
public void transferCompleted(TransferEvent event) {
}
@Override
public void transferError(TransferEvent event) {
}
@Override
public void debug(String s) {
}
}
@@ -418,6 +418,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase {
AsyncResult<MavenArtifactDownloader.DownloadResult> result = new AsyncResult<MavenArtifactDownloader.DownloadResult>();
result.doWhenDone(new AsyncResult.Handler<MavenArtifactDownloader.DownloadResult>() {
@Override
public void run(MavenArtifactDownloader.DownloadResult unresolvedArtifacts) {
unresolved[0] = unresolvedArtifacts;
}
@@ -481,6 +482,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase {
CompileScope scope = new ModuleCompileScope(myProject, modules.toArray(new Module[modules.size()]), false);
CompilerManager.getInstance(myProject).make(scope, new CompileStatusNotification() {
@Override
public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
assertFalse(aborted);
assertEquals(collectMessages(compileContext, CompilerMessageCategory.ERROR), 0, errors);
@@ -501,6 +503,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase {
protected AtomicInteger configConfirmationForYesAnswer() {
final AtomicInteger counter = new AtomicInteger();
Messages.setTestDialog(new TestDialog() {
@Override
public int show(String message) {
counter.set(counter.get() + 1);
return 0;
@@ -512,6 +515,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase {
protected AtomicInteger configConfirmationForNoAnswer() {
final AtomicInteger counter = new AtomicInteger();
Messages.setTestDialog(new TestDialog() {
@Override
public int show(String message) {
counter.set(counter.get() + 1);
return 1;
@@ -86,6 +86,7 @@ public abstract class MavenTestCase extends UsefulTestCase {
restoreSettingsFile();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
try {
setUpInWriteAction();
@@ -162,6 +163,7 @@ public abstract class MavenTestCase extends UsefulTestCase {
try {
if (runInWriteAction()) {
new WriteAction() {
@Override
protected void run(Result result) throws Throwable {
MavenTestCase.super.runTest();
}
@@ -24,20 +24,25 @@ public class NullMavenConsole extends MavenConsole {
super(MavenExecutionOptions.LoggingLevel.DISABLED, false);
}
@Override
public boolean canPause() {
return false;
}
@Override
public boolean isOutputPaused() {
return false;
}
@Override
public void setOutputPaused(boolean outputPaused) {
}
@Override
public void attachToProcess(ProcessHandler processHandler) {
}
@Override
protected void doPrint(String text, MavenConsole.OutputType type) {
}
}
@@ -1016,26 +1016,32 @@ public class MavenDependencyCompletionAndResolutionTest extends MavenDomWithIndi
myFiles = files;
}
@Override
public FileChooserDialog createFileChooser(FileChooserDescriptor descriptor, Project project) {
return new MyFileChooserDialog(myFiles);
}
@Override
public FileChooserDialog createFileChooser(FileChooserDescriptor descriptor, Component parent) {
return new MyFileChooserDialog(myFiles);
}
@Override
public FileTextField createFileTextField(FileChooserDescriptor descriptor, boolean showHidden, Disposable parent) {
throw new UnsupportedOperationException();
}
@Override
public FileTextField createFileTextField(FileChooserDescriptor descriptor, Disposable parent) {
throw new UnsupportedOperationException();
}
@Override
public void installFileCompletion(JTextField field, FileChooserDescriptor descriptor, boolean showHidden, Disposable parent) {
throw new UnsupportedOperationException();
}
@Override
public FileSaverDialog createSaveFileDialog(FileSaverDescriptor descriptor, Project project) {
throw new UnsupportedOperationException();
}
@@ -1048,6 +1054,7 @@ public class MavenDependencyCompletionAndResolutionTest extends MavenDomWithIndi
myFiles = files;
}
@Override
@NotNull
public VirtualFile[] choose(@Nullable VirtualFile toSelect, @Nullable Project project) {
return myFiles;
@@ -329,6 +329,7 @@ public abstract class MavenDomTestCase extends MavenImportingTestCase {
protected List<PsiElement> search(VirtualFile file) throws IOException {
final MapDataContext context = createDataContext(file);
UsageTarget[] targets = UsageTargetUtil.findUsageTargets(new DataProvider() {
@Override
public Object getData(@NonNls String dataId) {
return context.getData(dataId);
}
@@ -336,6 +337,7 @@ public abstract class MavenDomTestCase extends MavenImportingTestCase {
PsiElement target = ((PsiElement2UsageTargetAdapter)targets[0]).getElement();
List<PsiReference> result = new ArrayList<PsiReference>(ReferencesSearch.search(target).findAll());
return ContainerUtil.map(result, new Function<PsiReference, PsiElement>() {
@Override
public PsiElement fun(PsiReference psiReference) {
return psiReference.getElement();
}
@@ -47,6 +47,7 @@ public class MavenModelReadingAndWritingTest extends MavenImportingTestCase {
public void testWriting() throws Exception {
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
@Override
public void run() {
MavenDomProjectModel model = getDomModel();
@@ -71,6 +72,7 @@ public class MavenModelReadingAndWritingTest extends MavenImportingTestCase {
public void testAddingADependency() throws Exception {
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
@Override
public void run() {
MavenDomProjectModel model = getDomModel();
@@ -96,6 +96,7 @@ public class MavenExecutionTest extends MavenImportingTestCase {
MavenRunConfigurationType.runConfiguration(myProject, params, getMavenGeneralSettings(),
new MavenRunnerSettings(),
new ProgramRunner.Callback() {
@Override
public void processStarted(final RunContentDescriptor descriptor) {
descriptor.getProcessHandler().addProcessListener(new ProcessAdapter() {
@Override
@@ -35,6 +35,7 @@ public class MavenRunnerSettingsTest extends MavenImportingTestCase {
@Override
protected void tearDown() throws Exception {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
for (Sdk each : myOldJdks) {
ProjectJdkTable.getInstance().addJdk(each);
@@ -38,6 +38,7 @@ public abstract class MavenPerformanceTest extends MavenImportingTestCase {
public void testReading() throws Exception {
measure(4000, new Runnable() {
@Override
public void run() {
myProjectsManager.waitForReadingCompletion();
}
@@ -47,6 +48,7 @@ public abstract class MavenPerformanceTest extends MavenImportingTestCase {
public void testImporting() throws Exception {
myProjectsManager.waitForReadingCompletion();
measure(8, new Runnable() {
@Override
public void run() {
myProjectsManager.importProjects();
}
@@ -57,6 +59,7 @@ public abstract class MavenPerformanceTest extends MavenImportingTestCase {
myProjectsManager.waitForReadingCompletion();
myProjectsManager.importProjects();
measure(2, new Runnable() {
@Override
public void run() {
myProjectsManager.importProjects();
}
@@ -67,6 +70,7 @@ public abstract class MavenPerformanceTest extends MavenImportingTestCase {
myProjectsManager.waitForReadingCompletion();
List<MavenProject> mavenProjects = myProjectsManager.getProjects();
Collections.sort(mavenProjects, new Comparator<MavenProject>() {
@Override
public int compare(MavenProject o1, MavenProject o2) {
return o1.getPath().compareToIgnoreCase(o2.getPath());
}
@@ -76,6 +80,7 @@ public abstract class MavenPerformanceTest extends MavenImportingTestCase {
myProjectsManager.scheduleResolveInTests(mavenProjects.subList(0, 100));
measure(50000, new Runnable() {
@Override
public void run() {
myProjectsManager.waitForResolvingCompletion();
}
@@ -36,10 +36,12 @@ public class MiscImportingTest extends MavenImportingTestCase {
protected void setUp() throws Exception {
super.setUp();
myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
@Override
public void beforeRootsChange(ModuleRootEvent event) {
beforeRootsChangedCount++;
}
@Override
public void rootsChanged(ModuleRootEvent event) {
rootsChangedCount++;
}
@@ -43,6 +43,7 @@ public abstract class MavenIndicesStressTest extends MavenIndicesTestCase implem
final AtomicBoolean isFinished = new AtomicBoolean(false);
Thread t1 = new Thread(new Runnable() {
@Override
public void run() {
try {
for (int i = 0; i < 3; i++) {
@@ -60,6 +61,7 @@ public abstract class MavenIndicesStressTest extends MavenIndicesTestCase implem
});
Thread t2 = new Thread(new Runnable() {
@Override
public void run() {
Random random = new Random();
while (!isFinished.get()) {
@@ -132,6 +134,7 @@ public abstract class MavenIndicesStressTest extends MavenIndicesTestCase implem
private Thread createThread(final MavenIndex index, final AtomicInteger finishedCount) {
Thread t2 = new Thread(new Runnable() {
@Override
public void run() {
try {
for (int i = 0; i < 1000; i++) {
@@ -148,6 +151,7 @@ public abstract class MavenIndicesStressTest extends MavenIndicesTestCase implem
return t2;
}
@Override
public void indexIsBroken(MavenIndex index) {
}
}
@@ -65,6 +65,7 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
myIndexer = MavenFacadeManager.getInstance().createIndexer();
myIndicesDir = new File(myDir, relativeDir);
myIndices = new MavenIndices(myIndexer, myIndicesDir, new MavenIndex.IndexListener() {
@Override
public void indexIsBroken(MavenIndex index) {
isBroken = true;
}
@@ -158,9 +158,11 @@ public class MavenFoldersImporterTest extends MavenImportingTestCase {
final int[] count = new int[]{0};
myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
@Override
public void beforeRootsChange(ModuleRootEvent event) {
}
@Override
public void rootsChanged(ModuleRootEvent event) {
count[0]++;
}
@@ -196,9 +198,11 @@ public class MavenFoldersImporterTest extends MavenImportingTestCase {
final int[] count = new int[]{0};
myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
@Override
public void beforeRootsChange(ModuleRootEvent event) {
}
@Override
public void rootsChanged(ModuleRootEvent event) {
count[0]++;
}
@@ -769,6 +769,7 @@ public class MavenProjectReaderTest extends MavenTestCase {
"<name>${prop}</name>");
MavenModel p = readProject(module, new MavenProjectReaderProjectLocator() {
@Override
public VirtualFile findProjectFile(MavenId coordinates) {
return new MavenId("test", "parent", "1").equals(coordinates) ? parent : null;
}
@@ -993,6 +994,7 @@ public class MavenProjectReaderTest extends MavenTestCase {
MavenModel p = readProject(module);
assertOrderedElementsAreEqual(ContainerUtil.map(p.getProfiles(), new Function<MavenProfile, Object>() {
@Override
public Object fun(MavenProfile profile) {
return profile.getId();
}
@@ -1549,6 +1551,7 @@ public class MavenProjectReaderTest extends MavenTestCase {
}
private static class NullProjectLocator implements MavenProjectReaderProjectLocator {
@Override
public VirtualFile findProjectFile(MavenId coordinates) {
return null;
}
@@ -86,6 +86,7 @@ public class MavenProjectsTreeIgnoresTest extends MavenProjectsTreeTestCase {
private String format(List<MavenProject> projects) {
return StringUtil.join(projects, new Function<MavenProject, String>() {
@Override
public String fun(MavenProject project) {
return project.getMavenId().getArtifactId();
}
@@ -2191,6 +2191,7 @@ public class MavenProjectsTreeReadingTest extends MavenProjectsTreeTestCase {
return;
}
log += StringUtil.join(updated, new Function<MavenProject, String>() {
@Override
public String fun(MavenProject each) {
return each.getMavenId().getArtifactId();
}
@@ -25,6 +25,7 @@ public class MavenSettingsTest extends MavenTestCase {
MavenGeneralSettings s = new MavenGeneralSettings();
s.addListener(new MavenGeneralSettings.Listener() {
@Override
public void pathsChanged() {
log[0] += "changed ";
}
@@ -42,12 +43,15 @@ public class MavenSettingsTest extends MavenTestCase {
MavenImportingSettings s = new MavenImportingSettings();
s.addListener(new MavenImportingSettings.Listener() {
@Override
public void autoImportChanged() {
}
@Override
public void createModuleGroupsChanged() {
}
@Override
public void createModuleForAggregatorsChanged() {
log[0] += "changed ";
}
@@ -64,6 +64,7 @@ public class DictionaryTest extends TestCase {
final Transformation transform = new Transformation();
PlatformTestUtil.assertTiming("Dictionary load time depends on words count. Approximate word count: " + wordCount + ".", times.get(name),
new Runnable() {
@Override
public void run() {
dictionary = CompressedDictionary.create(new StreamLoader(DefaultBundledDictionariesProvider.class.getResourceAsStream(name), name), transform);
}
@@ -71,6 +72,7 @@ public class DictionaryTest extends TestCase {
final Set<String> wordsToStoreAndCheck = createWordSets(name, 50000, 1).getFirst();
PlatformTestUtil.assertTiming("Invoke 'contains' " + wordsToStoreAndCheck.size() + " times", 2000, new Runnable() {
@Override
public void run() {
for (String s : wordsToStoreAndCheck) {
assertTrue(dictionary.contains(s));
@@ -82,12 +84,14 @@ public class DictionaryTest extends TestCase {
private static Loader createLoader(final Set<String> words) {
return new Loader() {
@Override
public void load(@NotNull Consumer<String> consumer) {
for (String word : words) {
consumer.consume(word);
}
}
@Override
public String getName() {
return "test";
}
@@ -103,6 +107,7 @@ public class DictionaryTest extends TestCase {
loader.load(new Consumer<String>() {
private int counter = 0;
@Override
public void consume(String s) {
if (counter > maxCount) {
return;
@@ -24,6 +24,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
public class CommentsWithMistakesInspectionTest extends SpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/commentsWithMistakes";
}
@@ -23,6 +23,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
*/
public class GroovyFileWithTypos extends SpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/groovy";
}
@@ -23,6 +23,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
*/
public class JSFileWithTypos extends SpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/js";
}
@@ -24,6 +24,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
public class JavaSpellcheckingTest extends SpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/java";
}
@@ -23,6 +23,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
*/
public class PhpFileWithTypos extends SpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/php";
}
@@ -21,6 +21,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
* @author Konstantin Bulenkov
*/
public class PropertiesTest extends SpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/propertiesWithMistakes";
}
@@ -22,6 +22,7 @@ import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
* User: Ekaterina Shliakhovetskaja
*/
public class XmlWithMistakesInspectionTest extends SpellcheckerInspectionTestCase {
@Override
protected String getBasePath() {
return getSpellcheckerTestDataPath() + "/inspection/xmlWithMistakes";
}
@@ -31,6 +31,7 @@ public class SvnAddTest extends SvnTestCase {
public void testDirAndFileInCommand() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
new WriteCommandAction.Simple(myProject) {
@Override
public void run() {
try {
VirtualFile dir = myWorkingCopyDir.createChildDirectory(this, "child");
@@ -46,6 +46,7 @@ public class SvnCachingRevisionsTest extends CodeInsightFixtureTestCase {
myRevisions = revisions;
}
@Override
public List<CommittedChangeList> loadInterval(final SVNRevision fromIncluding, final SVNRevision toIncluding, final int maxCount,
final boolean includingYoungest, final boolean includeOldest) throws SVNException {
long young = fromIncluding.getNumber();
@@ -91,6 +92,7 @@ public class SvnCachingRevisionsTest extends CodeInsightFixtureTestCase {
super(iterator, origin);
}
@Override
public void doCacheUpdate(final List<List<Fragment>> fragments) {
assert false;
}
@@ -37,6 +37,7 @@ public class SvnConcurrentChangeListManagerTest extends SvnTestCase {
final String newName = "renamed";
myScheme.doTest(new Runnable() {
@Override
public void run() {
changeListManager.editName(list.getName(), newName);
checkFilesAreInList(new VirtualFile[] {file}, newName, changeListManager);
@@ -63,6 +64,7 @@ public class SvnConcurrentChangeListManagerTest extends SvnTestCase {
final String finalText = "final text";
myScheme.doTest(new Runnable() {
@Override
public void run() {
final String intermediate = "intermediate text";
changeListManager.editComment(list.getName(), intermediate);
@@ -96,6 +98,7 @@ public class SvnConcurrentChangeListManagerTest extends SvnTestCase {
changeListManager.moveChangesTo(list, new Change[] {changeListManager.getChange(file)});
myScheme.doTest(new Runnable() {
@Override
public void run() {
changeListManager.moveChangesTo(target, new Change[] {changeListManager.getChange(file)});
checkFilesAreInList(new VirtualFile[] {file}, target.getName(), changeListManager);
@@ -120,6 +123,7 @@ public class SvnConcurrentChangeListManagerTest extends SvnTestCase {
changeListManager.moveChangesTo(list, new Change[] {changeListManager.getChange(file)});
myScheme.doTest(new Runnable() {
@Override
public void run() {
changeListManager.setDefaultChangeList(target);
assert changeListManager.getDefaultChangeList().getName().equals(target.getName());
@@ -144,6 +148,7 @@ public class SvnConcurrentChangeListManagerTest extends SvnTestCase {
changeListManager.moveChangesTo(list, new Change[] {changeListManager.getChange(file)});
myScheme.doTest(new Runnable() {
@Override
public void run() {
changeListManager.removeChangeList(list.getName());
assert changeListManager.findChangeList(list.getName()) == null;
@@ -172,6 +177,7 @@ public class SvnConcurrentChangeListManagerTest extends SvnTestCase {
changeListManager.moveChangesTo(list, new Change[] {changeListManager.getChange(file)});
myScheme.doTest(new Runnable() {
@Override
public void run() {
changeListManager.moveChangesTo(target, new Change[] {changeListManager.getChange(file)});
checkFilesAreInList(new VirtualFile[] {file}, target.getName(), changeListManager);
@@ -198,6 +204,7 @@ public class SvnConcurrentChangeListManagerTest extends SvnTestCase {
changeListManager.moveChangesTo(list, new Change[] {changeListManager.getChange(file)});
myScheme.doTest(new Runnable() {
@Override
public void run() {
changeListManager.moveChangesTo(target, new Change[] {changeListManager.getChange(file)});
checkFilesAreInList(new VirtualFile[] {file}, target.getName(), changeListManager);
@@ -225,6 +232,7 @@ public class SvnConcurrentChangeListManagerTest extends SvnTestCase {
final String targetName = "target";
myScheme.doTest(new Runnable() {
@Override
public void run() {
final LocalChangeList target = changeListManager.addChangeList(targetName, null);
changeListManager.moveChangesTo(target, new Change[] {changeListManager.getChange(file)});
@@ -273,6 +281,7 @@ public class SvnConcurrentChangeListManagerTest extends SvnTestCase {
final String finalName = "final list name";
myScheme.doTest(new Runnable() {
@Override
public void run() {
final LocalChangeList target = changeListManager.addChangeList(targetName, null);
changeListManager.moveChangesTo(target, new Change[] {changeListManager.getChange(file), changeListManager.getChange(fileB)});
@@ -309,6 +309,7 @@ public class SvnRenameTest extends SvnTestCase {
private void moveToNewPackage(final VirtualFile file, final String packageName) throws Throwable {
new WriteCommandAction.Simple(myProject) {
@Override
public void run() {
try {
final VirtualFile dir = myWorkingCopyDir.createChildDirectory(this, packageName);
@@ -78,13 +78,17 @@ public abstract class SvnTestCase extends AbstractVcsTestCase {
myGate = new MockChangeListManagerGate(ChangeListManager.getInstance(myProject));
myRefreshCopiesStub = new AtomicSectionsAware() {
@Override
public void enter() {
}
@Override
public void exit() {
}
@Override
public boolean shouldExitAsap() {
return false;
}
@Override
public void checkShouldExit() throws ProcessCanceledException {
}
};
@@ -16,6 +16,7 @@ public class VcsWaitForUpdateForTest extends SvnTestCase {
final Ref<Boolean> done = new Ref<Boolean>();
final Thread thread = new Thread(new Runnable() {
@Override
public void run() {
new EnsureUpToDateFromNonAWTThread(myProject).execute();
done.set(Boolean.TRUE);
@@ -41,11 +41,13 @@ import com.intellij.util.IncorrectOperationException;
public class FormEnumUsageTest extends PsiTestCase {
private VirtualFile myTestProjectRoot;
@Override
protected void setUp() throws Exception {
super.setUp();
ApplicationManager.getApplication().runWriteAction(
new Runnable() {
@Override
public void run() {
try{
String root = PluginPathManager.getPluginHomePath("ui-designer") + "/testData/binding/" + getTestName(true);
@@ -68,6 +70,7 @@ public class FormEnumUsageTest extends PsiTestCase {
public void testEnumUsage() throws IncorrectOperationException {
LanguageLevelProjectExtension.getInstance(myJavaFacade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
@Override
public void run() {
try {
createFile(myModule, myTestProjectRoot, "PropEnum.java", "public enum PropEnum { valueA, valueB }");
@@ -40,11 +40,13 @@ import java.util.Collection;
public class FormPropertyUsageTest extends PsiTestCase {
private VirtualFile myTestProjectRoot;
@Override
protected void setUp() throws Exception {
super.setUp();
ApplicationManager.getApplication().runWriteAction(
new Runnable() {
@Override
public void run() {
try{
String root = PluginPathManager.getPluginHomePath("ui-designer") + "/testData/binding/" + getTestName(true);
@@ -31,6 +31,7 @@ import junit.framework.Assert;
* @author ven
*/
public class RenameUIRelatedTest extends MultiFileTestCase {
@Override
protected String getTestRoot() {
return "/renameUIRelated/";
}
@@ -45,6 +46,7 @@ public class RenameUIRelatedTest extends MultiFileTestCase {
return JavaSdkImpl.getMockJdk17("java 1.5");
}
@Override
protected void setupProject(VirtualFile rootDir) {
LanguageLevelProjectExtension.getInstance(myJavaFacade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
super.setupProject(rootDir);
@@ -52,6 +54,7 @@ public class RenameUIRelatedTest extends MultiFileTestCase {
public void testRenameBoundField() throws Exception {
doTest(new PerformAction() {
@Override
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
PsiClass aClass = myJavaFacade.findClass("UIClass", ProjectScope.getAllScope(myProject));
Assert.assertNotNull(aClass);
@@ -65,6 +68,7 @@ public class RenameUIRelatedTest extends MultiFileTestCase {
public void testRenamePackage() throws Exception {
doTest(new PerformAction() {
@Override
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
PsiPackage aPackage = JavaPsiFacade.getInstance(myPsiManager.getProject()).findPackage("gov");
Assert.assertNotNull(aPackage);
@@ -77,6 +81,7 @@ public class RenameUIRelatedTest extends MultiFileTestCase {
public void testRenamePackageNested() throws Exception { // IDEADEV-28864
doTest(new PerformAction() {
@Override
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
PsiPackage aPackage = JavaPsiFacade.getInstance(myPsiManager.getProject()).findPackage("org.withoutForms");
Assert.assertNotNull(aPackage);
@@ -88,6 +93,7 @@ public class RenameUIRelatedTest extends MultiFileTestCase {
public void testRenamePackageWithComponentClass() throws Exception { // IDEADEV-5615
doTest(new PerformAction() {
@Override
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
PsiPackage aPackage = JavaPsiFacade.getInstance(myPsiManager.getProject()).findPackage("org.withoutForms");
Assert.assertNotNull(aPackage);
@@ -99,6 +105,7 @@ public class RenameUIRelatedTest extends MultiFileTestCase {
public void testRenameEnumConstant() throws Exception {
doTest(new PerformAction() {
@Override
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
PsiClass aClass = myJavaFacade.findClass("PropEnum", ProjectScope.getAllScope(myProject));
Assert.assertNotNull(aClass);
@@ -112,6 +119,7 @@ public class RenameUIRelatedTest extends MultiFileTestCase {
public void testRenameResourceBundle() throws Exception {
doTest(new PerformAction() {
@Override
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
PsiFile file = myPsiManager.findFile(rootDir.findChild("F1.properties"));
Assert.assertNotNull(file);
@@ -124,6 +132,7 @@ public class RenameUIRelatedTest extends MultiFileTestCase {
public void testRenameNestedForm() throws Exception {
doTest(new PerformAction() {
@Override
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
PsiFile file = myPsiManager.findFile(rootDir.findChild("p1").findChild("Form1.form"));
Assert.assertNotNull(file);
@@ -136,6 +145,7 @@ public class RenameUIRelatedTest extends MultiFileTestCase {
public void testRenameImage() throws Exception {
doTest(new PerformAction() {
@Override
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
PsiFile file = myPsiManager.findFile(rootDir.findFileByRelativePath("org/withoutForms/child/abstractClass.png"));
Assert.assertNotNull(file);
@@ -43,12 +43,14 @@ public class AsmCodeGeneratorTest extends TestCase {
private MyNestedFormLoader myNestedFormLoader;
private MyClassLoader myClassLoader;
@Override
protected void setUp() throws Exception {
super.setUp();
myNestedFormLoader = new MyNestedFormLoader();
myClassLoader = new MyClassLoader(getClass().getClassLoader());
}
@Override
protected void tearDown() throws Exception {
myClassLoader = null;
myNestedFormLoader = null;
@@ -78,6 +80,7 @@ public class AsmCodeGeneratorTest extends TestCase {
classStream.close();
FileUtil.delete(new File(classPath));
final File[] inners = new File(tmpPath).listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith(className + "$") && name.endsWith(".class");
}
@@ -339,10 +342,12 @@ public class AsmCodeGeneratorTest extends TestCase {
return defineClass(name, data, 0, data.length);
}
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
return super.loadClass(name);
}
@Override
public InputStream getResourceAsStream(String name) {
if (name.equals("TestProperties.properties")) {
return new ByteArrayInputStream(myTestProperties, 0, TEST_PROPERTY_CONTENT.length());
@@ -358,6 +363,7 @@ public class AsmCodeGeneratorTest extends TestCase {
myFormMap.put(formName, fileName);
}
@Override
public LwRootContainer loadForm(String formFileName) throws Exception {
final String fileName = myFormMap.get(formFileName);
if (fileName != null) {
@@ -366,6 +372,7 @@ public class AsmCodeGeneratorTest extends TestCase {
throw new UnsupportedOperationException("No nested form found for name " + formFileName);
}
@Override
public String getClassToBindName(LwRootContainer container) {
return container.getClassToBind();
}
@@ -38,11 +38,13 @@ public class FormSourceCodeGeneratorTest extends PsiTestCase {
private VirtualFile myTestProjectRoot;
private FormSourceCodeGenerator myGenerator;
@Override
protected void setUp() throws Exception {
super.setUp();
ApplicationManager.getApplication().runWriteAction(
new Runnable() {
@Override
public void run() {
try{
String root = PluginPathManager.getPluginHomePath("ui-designer") + "/testData/sourceCodeGenerator/" + getTestName(true);
@@ -100,6 +102,7 @@ public class FormSourceCodeGeneratorTest extends PsiTestCase {
final VirtualFile form = myTestProjectRoot.findChild("Test.form");
assertNotNull(form);
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
@Override
public void run() {
try {
myGenerator.generate(form);
@@ -32,6 +32,7 @@ public class GridInsertLocationTest extends TestCase {
private RadContainer myContainer;
private RadComponent myDropComponent;
@Override
protected void setUp() throws Exception {
super.setUp();
myManager = new RadGridLayoutManager();
@@ -33,6 +33,7 @@ public class RadFormLayoutManagerTest extends TestCase {
private RadContainer myContainer;
private FormLayout myLayout;
@Override
public void setUp() throws Exception {
super.setUp();
myManager = new RadFormLayoutManager();
@@ -31,6 +31,7 @@ public class RadGridBagLayoutManagerTest extends TestCase {
private RadGridBagLayoutManager myManager;
private RadContainer myContainer;
@Override
protected void setUp() throws Exception {
super.setUp();
myManager = new RadGridBagLayoutManager();
@@ -17,6 +17,7 @@ public class MoveFileTest extends MultiFileTestCase {
return PluginPathManager.getPluginHomePath("ui-designer") + "/testData";
}
@Override
protected String getTestRoot() {
return "/move/";
}
@@ -28,6 +29,7 @@ public class MoveFileTest extends MultiFileTestCase {
//Both names are relative to root directory
private void doTest(final String targetDirName, final String fileToMove) throws Exception {
doTest(new PerformAction() {
@Override
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
final VirtualFile child = rootDir.findFileByRelativePath(fileToMove);
assertNotNull("File " + fileToMove + " not found", child);
@@ -50,6 +50,7 @@ public class XPathCompletionTest extends TestBase {
myFixture.testCompletionVariants(getTestFileName() + ".xpath", expectedVariants);
}
@Override
protected String getSubPath() {
return "xpath/completion";
}
@@ -61,6 +61,7 @@ public class XPathHighlightingTest extends TestBase {
myFixture.testHighlighting(true, false, false, ArrayUtil.append(moreFiles, name + ".xpath"));
}
@Override
protected String getSubPath() {
return "xpath/highlighting";
}
@@ -107,6 +107,7 @@ public class XsltBasicTest extends TestBase {
}
}
@Override
protected String getSubPath() {
return "xslt";
}

Some files were not shown because too many files have changed in this diff Show More