make IG test light
authorBas Leijdekkers <basleijdekkers@gmail.com>
Thu, 15 Sep 2016 12:28:57 +0000 (14:28 +0200)
committerBas Leijdekkers <basleijdekkers@gmail.com>
Thu, 15 Sep 2016 12:46:22 +0000 (14:46 +0200)
plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/confusing_else/ConfusingElse.java
plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/confusing_else/expected.xml [deleted file]
plugins/InspectionGadgets/testsrc/com/siyeh/ig/controlflow/ConfusingElseInspectionTest.java

index 8bbaff2049ad8ac02e38cdab8ffa8181ecf43751..3467a5cf6e86b4405c131e42359f21b632a02cca 100644 (file)
@@ -5,7 +5,7 @@ public class ConfusingElse {
     public static void main(String[] args) {
         if (foo()) {
             return;
-        } else {
+        } <warning descr="'else' branch may be unwrapped, as the 'if' branch never completes">else</warning> {
             System.out.println("ConfusingElseInspection.main");
         }
         bar();
@@ -55,7 +55,7 @@ public class ConfusingElse {
     void elseIf(int i) {
         if (i == 1) {
             return;
-        } else if (i == 3) {
+        } <warning descr="'else' branch may be unwrapped, as the 'if' branch never completes">else</warning> if (i == 3) {
             System.out.println("i = " + i);
         }
         System.out.println();
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/confusing_else/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/confusing_else/expected.xml
deleted file mode 100644 (file)
index d94e453..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<problems>
-  <problem>
-    <file>ConfusingElse.java</file>
-    <line>8</line>
-    <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Confusing 'else' branch</problem_class>
-    <description>&lt;code&gt;else&lt;/code&gt; branch may be unwrapped, as the if branch never completes #loc</description>
-  </problem>
-
-  <problem>
-    <file>ConfusingElse.java</file>
-    <line>58</line>
-    <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Confusing 'else' branch</problem_class>
-    <description>&lt;code&gt;else&lt;/code&gt; branch may be unwrapped, as the if branch never completes #loc</description>
-  </problem>
-
-</problems>
\ No newline at end of file
index 2dd49fa4729e33d6750a8042c554751cbac294a9..81a5dbbc3b450a2feea5f783587085f543e105e3 100644 (file)
@@ -1,12 +1,36 @@
+/*
+ * Copyright 2000-2016 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.controlflow;
 
-import com.siyeh.ig.IGInspectionTestCase;
+import com.intellij.codeInspection.InspectionProfileEntry;
+import com.siyeh.ig.LightInspectionTestCase;
+import org.jetbrains.annotations.Nullable;
 
-public class ConfusingElseInspectionTest
-  extends IGInspectionTestCase {
+/**
+ * @author Bas Leijdekkers
+ */
+public class ConfusingElseInspectionTest extends LightInspectionTestCase {
 
-  public void test() throws Exception {
-    doTest("com/siyeh/igtest/controlflow/confusing_else",
-           new ConfusingElseInspection());
+  public void testConfusingElse() {
+    doTest();
+  }
+
+  @Nullable
+  @Override
+  protected InspectionProfileEntry getInspection() {
+    return new ConfusingElseInspection();
   }
 }
\ No newline at end of file