Fix spellchecker tests
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Mon, 18 Feb 2013 09:41:25 +0000 (10:41 +0100)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Mon, 18 Feb 2013 09:41:25 +0000 (10:41 +0100)
13 files changed:
plugins/java-i18n/testData/inspection/CorrectJava.java [moved from spellchecker/testData/inspection/java/GenericTest.java with 100% similarity]
plugins/java-i18n/testData/inspection/Japanese.java [moved from spellchecker/testData/inspection/java/Japaneese.java with 100% similarity]
plugins/java-i18n/testData/inspection/Suppressions.java
plugins/java-i18n/testData/inspection/TypoInJava.java [moved from spellchecker/testData/inspection/java/GenericTestt.java with 100% similarity]
plugins/java-i18n/testData/inspection/VarArg.java [moved from spellchecker/testData/inspection/java/VarArgTest.java with 100% similarity]
plugins/java-i18n/testSrc/com/intellij/spellchecker/inspection/JavaSpellcheckerInspectionTest.java
spellchecker/testData/inspection/java/Suppression.java [deleted file]
spellchecker/testSrc/com/intellij/spellchecker/inspection/CommentsWithMistakesInspectionTest.java
spellchecker/testSrc/com/intellij/spellchecker/inspection/JavaSpellcheckingTest.java [deleted file]
spellchecker/testSrc/com/intellij/spellchecker/inspection/LightSpellCheckerTestCase.java [deleted file]
spellchecker/testSrc/com/intellij/spellchecker/inspection/PropertiesTest.java
spellchecker/testSrc/com/intellij/spellchecker/inspection/SpellcheckerInspectionTestCase.java
spellchecker/testSrc/com/intellij/spellchecker/inspection/XmlWithMistakesInspectionTest.java

index bb6634f849b9f00e86cf36953bf9bfe55576caab..782029a33b45fba5a495189f6b2ff8fd9184f443 100644 (file)
@@ -14,3 +14,11 @@ class GoodName {
   @SuppressWarnings("SpellCheckingInspection") int baddField;
   @SuppressWarnings("SpellCheckingInspection") void baddMethod() { }
 }
+
+@SuppressWarnings("asdfasd")
+class Foo {
+  {
+    //noinspection asdfasdf
+    int <TYPO descr="Typo: In word 'adsaf'">adsaf</TYPO> = 1;
+  }
+}
\ No newline at end of file
index e65e866ad4274b1e9ed7fc9cef9250c3cff37c5f..0a247e30788f9218bc31b78a890786091b7831d3 100644 (file)
@@ -24,6 +24,11 @@ public class JavaSpellcheckerInspectionTest extends LightCodeInsightFixtureTestC
     return PluginPathManager.getPluginHomePathRelative("java-i18n") + "/testData/inspection";
   }
 
+  public void testCorrectJava() { doTest(); }
+  public void testTypoInJava() { doTest(); }
+  public void testVarArg() { doTest(); }
+  public void testJapanese() { doTest(); }
+
   public void testClassName() { doTest(); }
   public void testFieldName() { doTest(); }
   public void testMethodName() { doTest(); }
diff --git a/spellchecker/testData/inspection/java/Suppression.java b/spellchecker/testData/inspection/java/Suppression.java
deleted file mode 100644 (file)
index 1a8f0eb..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-import java.lang.SuppressWarnings;
-
-@SuppressWarnings("asdfasd")
-class Foo {
-  {
-    //noinspection asdfasdf
-    int <TYPO descr="Typo: In word 'adsaf'">adsaf</TYPO> = 1;
-  }
-}
\ No newline at end of file
index cc64b2924177572523c84be86b92e09dfc7098dc..e91ccf7f47784e88dd8ec253e9ce3b0964e6879e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2013 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.
 package com.intellij.spellchecker.inspection;
 
 /**
- * Created by IntelliJ IDEA.
- * User: Ekaterina Shliakhovetskaja
+ * @author  Ekaterina Shliakhovetskaja
  */
 public class CommentsWithMistakesInspectionTest extends SpellcheckerInspectionTestCase {
-
-
   @Override
   protected String getBasePath() {
     return getSpellcheckerTestDataPath() + "/inspection/commentsWithMistakes";
   }
 
-  public void testJava() throws Throwable {
-    doTest("SPITest1.java", getInspectionTools());
+  public void testJava() {
+    doTest("SPITest1.java");
   }
 
-  public void testXml() throws Throwable {
-    doTest("A.xml", getInspectionTools());
+  public void testXml() {
+    doTest("A.xml");
   }
 
-  public void testHtml() throws Throwable {
-    doTest("test.html", getInspectionTools());
+  public void testHtml() {
+    doTest("test.html");
   }
 
-  public void testTxt() throws Throwable {
-    doTest("test.txt", getInspectionTools());
+  public void testTxt() {
+    doTest("test.txt");
   }
-
-  
 }
diff --git a/spellchecker/testSrc/com/intellij/spellchecker/inspection/JavaSpellcheckingTest.java b/spellchecker/testSrc/com/intellij/spellchecker/inspection/JavaSpellcheckingTest.java
deleted file mode 100644 (file)
index d1107b7..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2000-2009 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.spellchecker.inspection;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Ekaterina Shliakhovetskaja
- */
-public class JavaSpellcheckingTest extends SpellcheckerInspectionTestCase {
-
-
-  @Override
-  protected String getBasePath() {
-    return getSpellcheckerTestDataPath() + "/inspection/java";
-  }
-
-  public void testCorrectJava() throws Throwable {
-    doTest("GenericTest.java", getInspectionTools());
-  }
-
-  public void testTypoInJava() throws Throwable {
-    doTest("GenericTestt.java", getInspectionTools());
-  }
-
-  public void testVarArg() throws Throwable {
-    doTest("VarArgTest.java", getInspectionTools());
-  }
-
-  public void testJapaneese() throws Throwable {
-    doTest(getTestName(false) + ".java", getInspectionTools());
-  }
-
-  public void testSuppression() throws Throwable {
-    myFixture.addFileToProject("java/lang/SuppressWarnings.java", "package java.lang; public @interface SuppressWarnings { public String[] value(); }");
-    doTest(getTestName(false) + ".java", getInspectionTools());
-  }
-}
diff --git a/spellchecker/testSrc/com/intellij/spellchecker/inspection/LightSpellCheckerTestCase.java b/spellchecker/testSrc/com/intellij/spellchecker/inspection/LightSpellCheckerTestCase.java
deleted file mode 100644 (file)
index 87b2f7b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2000-2011 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.spellchecker.inspection;
-
-import com.intellij.spellchecker.inspections.SpellCheckingInspection;
-import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
-
-/**
- * @author yole
- */
-public abstract class LightSpellCheckerTestCase extends LightPlatformCodeInsightFixtureTestCase  {
-  protected void doTest(final String file) {
-    myFixture.enableInspections(new SpellCheckingInspection());
-    myFixture.configureByFile(file);
-    myFixture.testHighlighting(false, false, true);
-  }
-
-  @Override
-  protected boolean isWriteActionRequired() {
-    return false;
-  }
-}
index f67be482dbcf2f87c7bf0323a48d9fea2174ae5a..39cc46748a1bb7883d49a6db37e7edfbf0cb5fb1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2013 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,7 +24,7 @@ public class PropertiesTest extends SpellcheckerInspectionTestCase {
     return getSpellcheckerTestDataPath() + "/inspection/propertiesWithMistakes";
   }
 
-  public void testProperties() throws Throwable {
-    doTest("test.properties", getInspectionTools());
+  public void testProperties() {
+    doTest("test.properties");
   }
 }
index 73c8a066a0aabf63716161b0876f3a635433f844..efc00486d51a35f96284d27fa86a913cef07abde 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2013 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.
 package com.intellij.spellchecker.inspection;
 
 import com.intellij.codeInspection.LocalInspectionTool;
-import com.intellij.openapi.application.PluginPathManager;
 import com.intellij.spellchecker.inspections.SpellCheckingInspection;
-import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase;
+import com.intellij.testFramework.PlatformTestCase;
+import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
+
+public abstract class SpellcheckerInspectionTestCase extends LightPlatformCodeInsightFixtureTestCase {
+  @SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
+  protected SpellcheckerInspectionTestCase() {
+    PlatformTestCase.initPlatformLangPrefix();
+  }
+
+  @Override
+  protected boolean isCommunity() {
+    return true;
+  }
+
+  @Override
+  protected boolean isWriteActionRequired() {
+    return false;
+  }
 
-public abstract class SpellcheckerInspectionTestCase extends CodeInsightFixtureTestCase {
   public static String getSpellcheckerTestDataPath() {
-    return PluginPathManager.getPluginHomePathRelative("spellchecker") + "/testData";
+    return "/spellchecker/testData/";
   }
 
-  protected void doTest(String file, LocalInspectionTool... tools) throws Throwable {
-    myFixture.enableInspections(tools);
+  protected void doTest(String file) {
+    myFixture.enableInspections(getInspectionTools());
     myFixture.testHighlighting(false, false, true, file);
   }
 
   public static LocalInspectionTool[] getInspectionTools() {
     return new LocalInspectionTool[]{new SpellCheckingInspection()};
-
   }
 }
index b78087404970bc6814eb3a48743e3c5b233aa164..a212cda9aad278177dcc1d6d3ccb5e4f01378afc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2013 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.
 package com.intellij.spellchecker.inspection;
 
 /**
- * Created by IntelliJ IDEA.
- * User: Ekaterina Shliakhovetskaja
+ * @author Ekaterina Shliakhovetskaja
  */
-public class XmlWithMistakesInspectionTest extends LightSpellCheckerTestCase {
+public class XmlWithMistakesInspectionTest extends SpellcheckerInspectionTestCase {
   @Override
   protected String getBasePath() {
-    return SpellcheckerInspectionTestCase.getSpellcheckerTestDataPath() + "/inspection/xmlWithMistakes";
+    return SpellcheckerInspectionTestCase.getSpellcheckerTestDataPath() + "inspection/xmlWithMistakes";
   }
 
   public void testXml() {
     doTest("test.xml");
   }
 }
-
-