mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make IG test light
This commit is contained in:
+5
-5
@@ -2,13 +2,13 @@ package com.siyeh.igtest.migration.while_can_be_foreach;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class WhileCanBeForeachInspection {
|
||||
public class WhileCanBeForeach {
|
||||
|
||||
public int baz() {
|
||||
int total = 0;
|
||||
final List ints = new ArrayList();
|
||||
Iterator iterator = ints.iterator();
|
||||
while ( iterator.hasNext()) {
|
||||
<warning descr="'while' loop replaceable with 'foreach'">while</warning> ( iterator.hasNext()) {
|
||||
total += (Integer) iterator.next();
|
||||
}
|
||||
return total;
|
||||
@@ -18,7 +18,7 @@ public class WhileCanBeForeachInspection {
|
||||
int total = 0;
|
||||
final List ints = new ArrayList();
|
||||
Iterator iterator = ints.iterator();
|
||||
while ( iterator.hasNext()) {
|
||||
<warning descr="'while' loop replaceable with 'foreach'">while</warning> ( iterator.hasNext()) {
|
||||
total += (Integer) iterator.next();
|
||||
}
|
||||
iterator = ints.iterator(); // write use here
|
||||
@@ -38,7 +38,7 @@ public class WhileCanBeForeachInspection {
|
||||
|
||||
void no(Collection pbps, Map tracksToPBP) {
|
||||
final Iterator pbpsIt = pbps.iterator();
|
||||
while (pbpsIt.hasNext()) {
|
||||
<warning descr="'while' loop replaceable with 'foreach'">while</warning> (pbpsIt.hasNext()) {
|
||||
final String pbp = (String) pbpsIt.next();
|
||||
final Iterator trackIt = it();
|
||||
while (trackIt.hasNext()) {
|
||||
@@ -70,7 +70,7 @@ public class WhileCanBeForeachInspection {
|
||||
int total = 0;
|
||||
final List ints = new ArrayList();
|
||||
ListIterator iterator = ints.listIterator();
|
||||
while ( iterator.hasNext()) {
|
||||
<warning descr="'while' loop replaceable with 'foreach'">while</warning> ( iterator.hasNext()) {
|
||||
final Object next = iterator.next();
|
||||
total += (Integer) next;
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
|
||||
<problem>
|
||||
<file>WhileCanBeForeachInspection.java</file>
|
||||
<line>11</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'while' loop replaceable with 'for each'</problem_class>
|
||||
<description><code>while</code> loop replaceable with 'for each'</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>WhileCanBeForeachInspection.java</file>
|
||||
<line>21</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'while' loop replaceable with 'for each'</problem_class>
|
||||
<description><code>while</code> loop replaceable with 'for each'</description>
|
||||
</problem>
|
||||
|
||||
|
||||
<problem>
|
||||
<file>WhileCanBeForeachInspection.java</file>
|
||||
<line>41</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'while' loop replaceable with 'for each'</problem_class>
|
||||
<description><code>while</code> loop replaceable with 'for each'</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>WhileCanBeForeachInspection.java</file>
|
||||
<line>73</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'while' loop replaceable with 'for each'</problem_class>
|
||||
<description><code>while</code> loop replaceable with 'for each' #loc</description>
|
||||
</problem>
|
||||
|
||||
</problems>
|
||||
+12
-5
@@ -1,11 +1,18 @@
|
||||
package com.siyeh.ig.migration;
|
||||
|
||||
import com.siyeh.ig.IGInspectionTestCase;
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.siyeh.ig.LightInspectionTestCase;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class WhileCanBeForeachInspectionTest extends IGInspectionTestCase {
|
||||
public class WhileCanBeForeachInspectionTest extends LightInspectionTestCase {
|
||||
|
||||
public void test() throws Exception {
|
||||
doTest("com/siyeh/igtest/migration/while_can_be_foreach",
|
||||
new WhileCanBeForeachInspection());
|
||||
public void testWhileCanBeForeach() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
return new WhileCanBeForeachInspection();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user