diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java index 72874131f79c..082e532a244e 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2012 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.codeInsight.daemon; import com.intellij.ExtensionPoints; @@ -266,10 +281,11 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase { public void testNamesHighlighting() throws Exception { LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(LanguageLevel.JDK_1_5); - testFile(BASE_PATH + "/" + getTestName(false) + ".java").checkSymbolNames().test(); + doTestFile(BASE_PATH + "/" + getTestName(false) + ".java").checkSymbolNames().test(); } + public void testMultiFieldDeclNames() throws Exception { - testFile(BASE_PATH + "/" + getTestName(false) + ".java").checkSymbolNames().test(); + doTestFile(BASE_PATH + "/" + getTestName(false) + ".java").checkSymbolNames().test(); } public static class MyAnnotator implements Annotator { diff --git a/java/java-tests/testSrc/com/intellij/psi/JavaSOEOnReparseTest.java b/java/java-tests/testSrc/com/intellij/psi/JavaSOEOnReparseTest.java index 4aac606be8e4..6f2ae551057d 100644 --- a/java/java-tests/testSrc/com/intellij/psi/JavaSOEOnReparseTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/JavaSOEOnReparseTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -18,12 +18,23 @@ package com.intellij.psi; import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase; import com.intellij.openapi.application.ApplicationManager; - public class JavaSOEOnReparseTest extends LightDaemonAnalyzerTestCase { - private static final StringBuilder HUGE_EXPR; - static { - HUGE_EXPR = new StringBuilder("\"-\""); - for (int i = 0; i < 100000; i++) HUGE_EXPR.append("+\"b\""); + private StringBuilder myHugeExpr; + + @Override + public void setUp() throws Exception { + super.setUp(); + myHugeExpr = new StringBuilder("\"-\""); + for (int i = 0; i < 100000; i++) myHugeExpr.append("+\"b\""); + } + + @Override + public void tearDown() throws Exception { + if (myHugeExpr != null) { + myHugeExpr.setLength(0); + myHugeExpr = null; + } + super.tearDown(); } public void testOnHugeBinaryExprInFile() throws Exception { @@ -42,7 +53,7 @@ public class JavaSOEOnReparseTest extends LightDaemonAnalyzerTestCase { // replace small expression with huge binary one ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { - getEditor().getDocument().replaceString(pos, pos + 2, HUGE_EXPR); + getEditor().getDocument().replaceString(pos, pos + 2, myHugeExpr); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); }}); doTestConfiguredFile(false, false, null); @@ -66,7 +77,7 @@ public class JavaSOEOnReparseTest extends LightDaemonAnalyzerTestCase { // replace huge binary expression with small one ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { - getEditor().getDocument().replaceString(pos, pos + HUGE_EXPR.length(), "\".\""); + getEditor().getDocument().replaceString(pos, pos + myHugeExpr.length(), "\".\""); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); }}); doTestConfiguredFile(false, false, null); diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java index 7556d7e86fe5..54cf9b45539a 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -79,7 +79,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa doTestConfiguredFile(checkWarnings, checkInfos, filePath); } - protected void doTestConfiguredFile(boolean checkWarnings, boolean checkInfos, String filePath) { + protected void doTestConfiguredFile(boolean checkWarnings, boolean checkInfos, @Nullable String filePath) { getJavaFacade().setAssertOnFileLoadingFilter(VirtualFileFilter.NONE); ExpectedHighlightingData data = new ExpectedHighlightingData(getEditor().getDocument(),checkWarnings, checkInfos); @@ -87,7 +87,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa } @Nullable - private String composeLocalPath(String filePath) { + private String composeLocalPath(@Nullable String filePath) { return filePath != null ? getTestDataPath() + "/" + filePath : null; } @@ -106,7 +106,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa data.checkResult(infos, getEditor().getDocument().getText(), filePath); } - protected HighlightTestInfo testFile(@NonNls @NotNull String filePath) { + protected HighlightTestInfo doTestFile(@NonNls @NotNull String filePath) { return new HighlightTestInfo(getTestRootDisposable(), filePath){ @Override public HighlightTestInfo doTest() throws Exception {