diff options
Diffstat (limited to 'plugins/InspectionGadgets/testsrc')
18 files changed, 467 insertions, 28 deletions
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java index 2ce63ec4814e..47fd152debec 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java @@ -16,15 +16,21 @@ package com.siyeh.ig; import com.intellij.codeInsight.intention.IntentionAction; +import com.intellij.codeInspection.ex.QuickFixWrapper; import com.intellij.ide.highlighter.JavaFileType; import com.intellij.openapi.application.PluginPathManager; +import com.intellij.openapi.util.Condition; import com.intellij.pom.java.LanguageLevel; import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase; import com.intellij.util.ArrayUtil; +import com.intellij.util.containers.ContainerUtil; import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import org.junit.Assert; + +import java.util.List; /** * @author anna @@ -73,6 +79,17 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas return PluginPathManager.getPluginHomePath("InspectionGadgets") + "/test/com/siyeh/igfixes/"; } + protected void assertQuickfixNotAvailable() { + assertQuickfixNotAvailable(myDefaultHint); + } + + protected void assertQuickfixNotAvailable(final String quickfixName) { + final String testName = getTestName(false); + myFixture.configureByFile(getRelativePath() + "/" + testName + ".java"); + assertEmpty("Quickfix \'" + quickfixName + "\' is available but should not", + myFixture.filterAvailableIntentions(quickfixName)); + } + protected void doTest() { assertNotNull(myDefaultHint); final String testName = getTestName(false); @@ -86,12 +103,36 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas protected void doTest(final String testName, final String hint) { myFixture.configureByFile(getRelativePath() + "/" + testName + ".java"); - final IntentionAction action = myFixture.findSingleIntention(hint); + final IntentionAction action = findIntention(hint); assertNotNull(action); myFixture.launchAction(action); myFixture.checkResultByFile(getRelativePath() + "/" + testName + ".after.java"); } + public IntentionAction findIntention(@NotNull final String hint) { + final List<IntentionAction> availableIntentions = + ContainerUtil.findAll(myFixture.getAvailableIntentions(), new Condition<IntentionAction>() { + @Override + public boolean value(final IntentionAction intentionAction) { + return intentionAction instanceof QuickFixWrapper; + } + }); + final List<IntentionAction> list = ContainerUtil.findAll(availableIntentions, new Condition<IntentionAction>() { + @Override + public boolean value(IntentionAction intentionAction) { + return intentionAction.getText().equals(hint); + } + }); + if (list.isEmpty()) { + Assert.fail("\"" + hint + "\" not in " + list); + } + else if (list.size() > 1) { + Assert.fail("Too many quickfixes found for \"" + hint + "\": " + list + "]"); + } + return list.get(0); + } + + protected void doExpressionTest( String hint, @Language(value = "JAVA", prefix = "class $X$ {{System.out.print(", suffix = ");}}") @NotNull @NonNls String before, @@ -109,7 +150,7 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas protected void doTest(String hint, @Language("JAVA") @NotNull @NonNls String before, @Language("JAVA") @NotNull @NonNls String after) { before = before.replace("/**/", "<caret>"); myFixture.configureByText(JavaFileType.INSTANCE, before); - final IntentionAction intention = myFixture.findSingleIntention(hint); + final IntentionAction intention = findIntention(hint); assertNotNull(intention); myFixture.launchAction(intention); myFixture.checkResult(after); diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/ResultSetIndexZeroInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/ResultSetIndexZeroInspectionTest.java new file mode 100644 index 000000000000..07a1c7d7150e --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/ResultSetIndexZeroInspectionTest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2000-2014 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.siyeh.ig.bugs; + +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; + +/** + * @author Bas Leijdekkers + */ +public class ResultSetIndexZeroInspectionTest extends LightInspectionTestCase { + + public void testResultSetIndexZero() { doTest(); } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + return new ResultSetIndexZeroInspection(); + } +} diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/StringEqualityInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/StringEqualityInspectionTest.java index 13aa1fa972ae..d17c0b31e19b 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/StringEqualityInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/StringEqualityInspectionTest.java @@ -1,10 +1,18 @@ package com.siyeh.ig.bugs; -import com.siyeh.ig.IGInspectionTestCase; +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; -public class StringEqualityInspectionTest extends IGInspectionTestCase { +public class StringEqualityInspectionTest extends LightInspectionTestCase { - public void test() throws Exception { - doTest("com/siyeh/igtest/bugs/string_equality", new StringEqualityInspection()); + public void testStringEquality() { + doTest(); + } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + return new StringEqualityInspection(); } }
\ No newline at end of file diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionTest.java index a177242537d2..397a2fe1d37e 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionTest.java @@ -41,6 +41,14 @@ public class ClassWithOnlyPrivateConstructorsInspectionTest extends LightInspect doTest("class X {}"); } + public void testEnum() { + doTest("enum Currencies {\n" + + " EURO, DOLLAR;\n" + + " private Currencies() {\n" + + " }\n" + + "}"); + } + @Nullable @Override protected InspectionProfileEntry getInspection() { diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/initialization/DoubleBraceInitializationFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/initialization/DoubleBraceInitializationFixTest.java new file mode 100644 index 000000000000..afce138a7a82 --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/initialization/DoubleBraceInitializationFixTest.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2014 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.siyeh.ig.fixes.initialization; + +import com.siyeh.InspectionGadgetsBundle; +import com.siyeh.ig.IGQuickFixesTestCase; +import com.siyeh.ig.initialization.DoubleBraceInitializationInspection; + +/** + * @author Bas Leijdekkers + */ +public class DoubleBraceInitializationFixTest extends IGQuickFixesTestCase { + + public void testLocalVariable() { doTest(); } + public void testField() { doTest(); } + public void testArgument() { assertQuickfixNotAvailable(); } + + @Override + protected void setUp() throws Exception { + super.setUp(); + myFixture.enableInspections(new DoubleBraceInitializationInspection()); + myRelativePath = "initialization/double_brace_initialization"; + myDefaultHint = InspectionGadgetsBundle.message("double.brace.initialization.quickfix"); + } +} diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/performance/InnerClassMayBeStaticFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/memory/InnerClassMayBeStaticFixTest.java index 92a27c5ac236..42c36bf212fb 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/performance/InnerClassMayBeStaticFixTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/memory/InnerClassMayBeStaticFixTest.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.siyeh.ig.fixes.performance; +package com.siyeh.ig.fixes.memory; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.IGQuickFixesTestCase; -import com.siyeh.ig.performance.InnerClassMayBeStaticInspection; +import com.siyeh.ig.memory.InnerClassMayBeStaticInspection; /** * @author Bas Leijdekkers @@ -28,7 +28,7 @@ public class InnerClassMayBeStaticFixTest extends IGQuickFixesTestCase { protected void setUp() throws Exception { super.setUp(); myFixture.enableInspections(new InnerClassMayBeStaticInspection()); - myRelativePath = "performance/inner_class_static"; + myRelativePath = "memory/inner_class_static"; myDefaultHint = InspectionGadgetsBundle.message("make.static.quickfix"); } diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/CStyleArrayDeclarationFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/CStyleArrayDeclarationFixTest.java new file mode 100644 index 000000000000..85a07f8e08c3 --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/CStyleArrayDeclarationFixTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 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.siyeh.ig.fixes.style; + +import com.siyeh.InspectionGadgetsBundle; +import com.siyeh.ig.IGQuickFixesTestCase; +import com.siyeh.ig.style.CStyleArrayDeclarationInspection; + +/** + * @author Bas Leijdekkers + */ +public class CStyleArrayDeclarationFixTest extends IGQuickFixesTestCase { + + public void testSimpleMethod() { doTest(); } + public void testFieldWithWhitespace() { doTest(); } + + @Override + public void setUp() throws Exception { + super.setUp(); + myFixture.enableInspections(new CStyleArrayDeclarationInspection()); + myRelativePath = "style/cstyle_array_declaration"; + myDefaultHint = InspectionGadgetsBundle.message("c.style.array.declaration.replace.quickfix"); + } +} diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/IntroduceHolderFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/IntroduceHolderFixTest.java new file mode 100644 index 000000000000..28557e5f35a1 --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/IntroduceHolderFixTest.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2014 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.siyeh.ig.fixes.threading; + +import com.siyeh.InspectionGadgetsBundle; +import com.siyeh.ig.IGQuickFixesTestCase; +import com.siyeh.ig.initialization.NonThreadSafeLazyInitializationInspection; + +/** + * @author Bas Leijdekkers + */ +public class IntroduceHolderFixTest extends IGQuickFixesTestCase { + + public void testNestedAssignment() { assertQuickfixNotAvailable(); } + public void testLocalVariableReferenced() { assertQuickfixNotAvailable(); } + public void testInstanceVariableReferenced() { assertQuickfixNotAvailable(); } + public void testStaticVariableReferenced() { doTest(); } + public void testNormal() { doTest(); } + + @Override + protected void setUp() throws Exception { + super.setUp(); + myFixture.enableInspections(new NonThreadSafeLazyInitializationInspection() + ); + myDefaultHint = InspectionGadgetsBundle.message("introduce.holder.class.quickfix"); + myRelativePath = "threading/non_thread_safe_lazy_initialization"; + } +} diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/MakeFieldVolatileFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/MakeFieldVolatileFixTest.java new file mode 100644 index 000000000000..4c9a623be4d5 --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/MakeFieldVolatileFixTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 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.siyeh.ig.fixes.threading; + +import com.siyeh.InspectionGadgetsBundle; +import com.siyeh.ig.IGQuickFixesTestCase; +import com.siyeh.ig.threading.DoubleCheckedLockingInspection; + +/** + * @author Bas Leijdekkers + */ +public class MakeFieldVolatileFixTest extends IGQuickFixesTestCase { + + public void testSimple() { doTest(InspectionGadgetsBundle.message("double.checked.locking.quickfix", "s_instance")); } + + @Override + protected void setUp() throws Exception { + super.setUp(); + final DoubleCheckedLockingInspection inspection = new DoubleCheckedLockingInspection(); + inspection.ignoreOnVolatileVariables = true; + myFixture.enableInspections(inspection); + myRelativePath = "threading/make_field_volatile"; + } +} diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/initialization/DoubleBraceInitializationInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/initialization/DoubleBraceInitializationInspectionTest.java new file mode 100644 index 000000000000..532018d5c26e --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/initialization/DoubleBraceInitializationInspectionTest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2000-2014 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.siyeh.ig.initialization; + +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; + +/** + * @author Bas Leijdekkers + */ +public class DoubleBraceInitializationInspectionTest extends LightInspectionTestCase { + + public void testDoubleBraceInitialization() { doTest(); } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + return new DoubleBraceInitializationInspection(); + } +} diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/initialization/NonThreadSafeLazyInitializationInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/initialization/NonThreadSafeLazyInitializationInspectionTest.java new file mode 100644 index 000000000000..331eb67dd5bf --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/initialization/NonThreadSafeLazyInitializationInspectionTest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2000-2014 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.siyeh.ig.initialization; + +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; + +/** + * @author Bas Leijdekkers + */ +public class NonThreadSafeLazyInitializationInspectionTest extends LightInspectionTestCase { + + public void testNonThreadSafeLazyInitialization() { doTest(); } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + return new NonThreadSafeLazyInitializationInspection(); + } +} diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/memory/AnonymousInnerClassMayBeStaticInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/memory/AnonymousInnerClassMayBeStaticInspectionTest.java new file mode 100644 index 000000000000..6fe5d7314190 --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/memory/AnonymousInnerClassMayBeStaticInspectionTest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2000-2014 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.siyeh.ig.memory; + +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; + +/** + * @author Bas Leijdekkers + */ +public class AnonymousInnerClassMayBeStaticInspectionTest extends LightInspectionTestCase { + + public void testAnonymousInnerClassMayBeStatic() { doTest(); } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + return new AnonymousInnerClassMayBeStaticInspection(); + } +}
\ No newline at end of file diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/memory/InnerClassMayBeStaticInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/memory/InnerClassMayBeStaticInspectionTest.java new file mode 100644 index 000000000000..36f42d1f12ef --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/memory/InnerClassMayBeStaticInspectionTest.java @@ -0,0 +1,16 @@ +package com.siyeh.ig.memory; + +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; + +public class InnerClassMayBeStaticInspectionTest extends LightInspectionTestCase { + + public void testInnerClassMayBeStatic() { doTest(); } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + return new InnerClassMayBeStaticInspection(); + } +}
\ No newline at end of file diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/performance/InnerClassMayBeStaticInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/performance/InnerClassMayBeStaticInspectionTest.java deleted file mode 100644 index 02b57fd22746..000000000000 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/performance/InnerClassMayBeStaticInspectionTest.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.siyeh.ig.performance; - -import com.siyeh.ig.IGInspectionTestCase; - -public class InnerClassMayBeStaticInspectionTest extends IGInspectionTestCase { - - public void test() throws Exception { - doTest("com/siyeh/igtest/performance/inner_class_may_be_static", - new InnerClassMayBeStaticInspection()); - } -}
\ No newline at end of file diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/CStyleArrayDeclarationInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/CStyleArrayDeclarationInspectionTest.java new file mode 100644 index 000000000000..613a0fc3bf3a --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/CStyleArrayDeclarationInspectionTest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2000-2014 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.siyeh.ig.style; + +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; + +/** + * @author Bas Leijdekkers + */ +public class CStyleArrayDeclarationInspectionTest extends LightInspectionTestCase { + + public void testCStyleArrayDeclaration() { doTest(); } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + return new CStyleArrayDeclarationInspection(); + } +} diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/NestedMethodCallInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/NestedMethodCallInspectionTest.java new file mode 100644 index 000000000000..d67a0d43f7d3 --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/NestedMethodCallInspectionTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 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.siyeh.ig.style; + +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; + +/** + * @author Bas Leijdekkers + */ +public class NestedMethodCallInspectionTest extends LightInspectionTestCase{ + + public void testNestedMethodCall() { doTest(); } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + final NestedMethodCallInspection inspection = new NestedMethodCallInspection(); + inspection.ignoreStaticMethods = true; + inspection.ignoreGetterCalls = true; + return inspection; + } +} diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/visibility/AmbiguousFieldAccessInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/visibility/AmbiguousFieldAccessInspectionTest.java index b3a13f462339..1007f54da048 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/visibility/AmbiguousFieldAccessInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/visibility/AmbiguousFieldAccessInspectionTest.java @@ -1,10 +1,16 @@ package com.siyeh.ig.visibility; -import com.siyeh.ig.IGInspectionTestCase; +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; -public class AmbiguousFieldAccessInspectionTest extends IGInspectionTestCase { +public class AmbiguousFieldAccessInspectionTest extends LightInspectionTestCase { - public void test() throws Exception { - doTest("com/siyeh/igtest/visibility/ambiguous_field_access", new AmbiguousFieldAccessInspection()); + public void testAmbiguousFieldAccess() { doTest(); } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + return new AmbiguousFieldAccessInspection(); } }
\ No newline at end of file diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/visibility/AmbiguousMethodCallInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/visibility/AmbiguousMethodCallInspectionTest.java index 78610e8597d6..7c1c1327ccd7 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/visibility/AmbiguousMethodCallInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/visibility/AmbiguousMethodCallInspectionTest.java @@ -1,10 +1,21 @@ package com.siyeh.ig.visibility; -import com.siyeh.ig.IGInspectionTestCase; +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; -public class AmbiguousMethodCallInspectionTest extends IGInspectionTestCase { +public class AmbiguousMethodCallInspectionTest extends LightInspectionTestCase { - public void test() throws Exception { - doTest("com/siyeh/igtest/visibility/ambiguous", new AmbiguousMethodCallInspection()); + public void testAmbiguousMethodCall() { doTest(); } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + return new AmbiguousMethodCallInspection(); + } + + @Override + protected String getBasePath() { + return "/plugins/InspectionGadgets/test/com/siyeh/igtest/visibility/ambiguous"; } }
\ No newline at end of file |