make IG test light
authorBas Leijdekkers <basleijdekkers@gmail.com>
Thu, 15 Sep 2016 12:25:50 +0000 (14:25 +0200)
committerBas Leijdekkers <basleijdekkers@gmail.com>
Thu, 15 Sep 2016 12:46:21 +0000 (14:46 +0200)
plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/double_negation/DoubleNegation.java
plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/double_negation/expected.xml [deleted file]
plugins/InspectionGadgets/testsrc/com/siyeh/ig/controlflow/DoubleNegationInspectionTest.java

index 892d98f4c1263561d341b07827c9188afd6ed5a7..60f27f2808114bc43d849f82a1341dbe1280b79f 100644 (file)
@@ -3,10 +3,10 @@ package com.siyeh.igtest.controlflow.double_negation;
 public class DoubleNegation {
 
   void negative(boolean b1, boolean b2, boolean b3) {
-    boolean r1 = !(b1 != b2);
-    boolean r2 = !!b1;
-    boolean r3 = !b1 != b2;
-    boolean r4 = (b1 != (b2 != b3));
-    boolean r5 = (b1 != b2 != b3);
+    boolean r1 = <warning descr="Double negation in '!(b1 != b2)'">!(b1 != b2)</warning>;
+    boolean r2 = <warning descr="Double negation in '!!b1'">!!b1</warning>;
+    boolean r3 = <warning descr="Double negation in '!b1 != b2'">!b1 != b2</warning>;
+    boolean r4 = (<warning descr="Double negation in 'b1 != (b2 != b3)'">b1 != (b2 != b3)</warning>);
+    boolean r5 = (<warning descr="Double negation in 'b1 != b2 != b3'">b1 != b2 != b3</warning>);
   }
 }
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/double_negation/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/double_negation/expected.xml
deleted file mode 100644 (file)
index 7bb4485..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<problems>
-  <problem>
-    <file>DoubleNegation.java</file>
-    <line>6</line>
-    <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Double negation</problem_class>
-    <description>Double negation in &lt;code&gt;!(b1 != b2)&lt;/code&gt; #loc</description>
-  </problem>
-
-  <problem>
-    <file>DoubleNegation.java</file>
-    <line>7</line>
-    <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Double negation</problem_class>
-    <description>Double negation in &lt;code&gt;!!b1&lt;/code&gt; #loc</description>
-  </problem>
-
-  <problem>
-    <file>DoubleNegation.java</file>
-    <line>8</line>
-    <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Double negation</problem_class>
-    <description>Double negation in &lt;code&gt;!b1 != b2&lt;/code&gt; #loc</description>
-  </problem>
-
-  <problem>
-    <file>DoubleNegation.java</file>
-    <line>9</line>
-    <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Double negation</problem_class>
-    <description>Double negation in &lt;code&gt;b1 != (b2 != b3)&lt;/code&gt; #loc</description>
-  </problem>
-
-  <problem>
-    <file>DoubleNegation.java</file>
-    <line>10</line>
-    <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Double negation</problem_class>
-    <description>Double negation in &lt;code&gt;b1 != b2 != b3&lt;/code&gt; #loc</description>
-  </problem>
-</problems>
\ No newline at end of file
index 18039b1c76c50dd391e77f1b1c4977e5c7312beb..537b0eafa5cee3a4d4489e8c01d4eed152f83d99 100644 (file)
@@ -1,11 +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 DoubleNegationInspectionTest
-  extends IGInspectionTestCase {
+/**
+ * @author Bas Leijdekkers
+ */
+public class DoubleNegationInspectionTest extends LightInspectionTestCase {
 
-  public void test() throws Exception {
-    doTest("com/siyeh/igtest/controlflow/double_negation", new DoubleNegationInspection());
+  public void testDoubleNegation() {
+    doTest();
+  }
+
+  @Nullable
+  @Override
+  protected InspectionProfileEntry getInspection() {
+    return new DoubleNegationInspection();
   }
 }
\ No newline at end of file