diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects/AssertWithSideEffects.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects/AssertWithSideEffects.java
index 57fba33b43df..9160fa16f5fa 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects/AssertWithSideEffects.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects/AssertWithSideEffects.java
@@ -10,11 +10,11 @@ public class AssertWithSideEffects {
}
void bar(int i) {
- assert i++ < 10;
+ assert i++ < 10;
}
void abc() {
- assert isSideEffect();
+ assert isSideEffect();
}
boolean isSideEffect() {
@@ -28,6 +28,6 @@ public class AssertWithSideEffects {
}
void jdbc(ResultSet rs) throws SQLException {
- assert rs.last();
+ assert rs.last();
}
}
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects/expected.xml
deleted file mode 100644
index 93d780851750..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects/expected.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
- AssertWithSideEffects.java
- 13
- 'assert' statement with side effects
- <code>assert</code> has side effects #loc
-
-
-
- AssertWithSideEffects.java
- 17
- 'assert' statement with side effects
- <code>assert</code> has side effects #loc
-
-
-
- AssertWithSideEffects.java
- 31
- 'assert' statement with side effects
- <code>assert</code> has side effects #loc
-
-
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects8/AssertWithSideEffects.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects8/AssertWithSideEffects.java
index d50c08eb95bf..3cd7e2c6de3e 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects8/AssertWithSideEffects.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects8/AssertWithSideEffects.java
@@ -4,13 +4,13 @@ import java.util.*;
public class AssertWithSideEffects {
void assertMutation() {
Matcher m = Pattern.compile("foobar").matcher("foo");
- assert m.matches();
+ assert m.matches();
assert Pattern.compile("foobar").matcher("foo").matches();
}
void assertMutation(Set set) {
- assert set.add("foo");
+ assert set.add("foo");
assert new HashSet<>().add("bar");
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects8/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects8/expected.xml
deleted file mode 100644
index 009fbe70bd77..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects8/expected.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- AssertWithSideEffects.java
- 7
- 'assert' statement with side effects
- <code>assert</code> has side effects #loc
-
-
- AssertWithSideEffects.java
- 13
- 'assert' statement with side effects
- <code>assert</code> has side effects #loc
-
-
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/AssertWithSideEffectsInspection8Test.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/AssertWithSideEffectsInspection8Test.java
index 072bf374e6f9..f9bb93c4cee7 100644
--- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/AssertWithSideEffectsInspection8Test.java
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/AssertWithSideEffectsInspection8Test.java
@@ -1,20 +1,28 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.siyeh.ig.bugs;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
-import com.intellij.testFramework.PsiTestUtil;
-import com.siyeh.ig.IGInspectionTestCase;
+import com.intellij.testFramework.LightProjectDescriptor;
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
+import org.jetbrains.annotations.NotNull;
-public class AssertWithSideEffectsInspection8Test extends IGInspectionTestCase {
+public class AssertWithSideEffectsInspection8Test extends LightCodeInsightFixtureTestCase {
@Override
- protected Sdk getTestProjectSdk() {
- // uses Regex
- return PsiTestUtil.addJdkAnnotations(IdeaTestUtil.getMockJdk18());
+ protected String getBasePath() {
+ return "/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects8";
}
- public void test() {
- doTest("com/siyeh/igtest/bugs/assert_with_side_effects8",
- new AssertWithSideEffectsInspection());
+ @NotNull
+ @Override
+ protected LightProjectDescriptor getProjectDescriptor() {
+ return JAVA_8_ANNOTATED;
+ }
+
+ private void doTest() {
+ myFixture.enableInspections(new AssertWithSideEffectsInspection());
+ myFixture.testHighlighting(getTestName(false) + ".java");
+ }
+
+ public void testAssertWithSideEffects() {
+ doTest();
}
}
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/AssertWithSideEffectsInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/AssertWithSideEffectsInspectionTest.java
index 1fdcb2061bb6..f51358c249f9 100644
--- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/AssertWithSideEffectsInspectionTest.java
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/AssertWithSideEffectsInspectionTest.java
@@ -1,19 +1,29 @@
+// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.siyeh.ig.bugs;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
-import com.intellij.testFramework.PsiTestUtil;
-import com.siyeh.ig.IGInspectionTestCase;
+import com.intellij.testFramework.LightProjectDescriptor;
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
+import org.jetbrains.annotations.NotNull;
-public class AssertWithSideEffectsInspectionTest extends IGInspectionTestCase {
+public class AssertWithSideEffectsInspectionTest extends LightCodeInsightFixtureTestCase {
@Override
- protected Sdk getTestProjectSdk() {
- // uses SQL
- return PsiTestUtil.addJdkAnnotations(IdeaTestUtil.getMockJdk17());
+ protected String getBasePath() {
+ return "/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/assert_with_side_effects";
}
- public void test() {
- doTest("com/siyeh/igtest/bugs/assert_with_side_effects",
- new AssertWithSideEffectsInspection());
+ @NotNull
+ @Override
+ protected LightProjectDescriptor getProjectDescriptor() {
+ // uses SQL
+ return JAVA_1_7_ANNOTATED;
+ }
+
+ private void doTest() {
+ myFixture.enableInspections(new AssertWithSideEffectsInspection());
+ myFixture.testHighlighting(getTestName(false) + ".java");
+ }
+
+ public void testAssertWithSideEffects() {
+ doTest();
}
}
\ No newline at end of file