mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IG: test IgnoreClassFix more
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
// "Ignore static fields with type 'java.lang.String'" "true"
|
||||
|
||||
class X {
|
||||
private static String nice;
|
||||
|
||||
synchronized void x() {
|
||||
System.out.println(<caret>nice);
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Ignore allocations of objects with type 'java.lang.String'" "true"
|
||||
|
||||
class X {
|
||||
void x() {
|
||||
new <caret>String();
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Ignore '.size()' calls on type 'java.util.ArrayList'" "true"
|
||||
import java.util.ArrayList;
|
||||
|
||||
class X {
|
||||
boolean x(ArrayList<String> list) {
|
||||
return list.<caret>size() == 0;
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Allow static imports for class 'java.lang.Math'" "true"
|
||||
|
||||
import static <caret>java.lang.Math.*;
|
||||
|
||||
class X {}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Ignore static fields with type 'java.lang.String'" "true"
|
||||
|
||||
class X {
|
||||
private static String nice;
|
||||
|
||||
synchronized void x() {
|
||||
System.out.println(<caret>nice);
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Ignore allocations of objects with type 'java.lang.String'" "true"
|
||||
|
||||
class X {
|
||||
void x() {
|
||||
new <caret>String();
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Ignore '.size()' calls on type 'java.util.ArrayList'" "true"
|
||||
import java.util.ArrayList;
|
||||
|
||||
class X {
|
||||
boolean x(ArrayList<String> list) {
|
||||
return list.<caret>size() == 0;
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Allow static imports for class 'java.lang.Math'" "true"
|
||||
|
||||
import static <caret>java.lang.Math.*;
|
||||
|
||||
class X {}
|
||||
@@ -0,0 +1,43 @@
|
||||
// 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.fixes;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.siyeh.ig.bugs.ResultOfObjectAllocationIgnoredInspection;
|
||||
import com.siyeh.ig.imports.StaticImportInspection;
|
||||
import com.siyeh.ig.style.SizeReplaceableByIsEmptyInspection;
|
||||
import com.siyeh.ig.threading.AccessToStaticFieldLockedOnInstanceInspection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class IgnoreClassFixTest extends LightQuickFixParameterizedTestCase {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LocalInspectionTool[] configureLocalInspectionTools() {
|
||||
return new LocalInspectionTool[]{
|
||||
new SizeReplaceableByIsEmptyInspection(),
|
||||
new ResultOfObjectAllocationIgnoredInspection(),
|
||||
new StaticImportInspection(),
|
||||
new AccessToStaticFieldLockedOnInstanceInspection()
|
||||
};
|
||||
}
|
||||
|
||||
public void test() {
|
||||
doAllTests();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "/com/siyeh/igfixes/fixes/ignore_class_fix";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PathManagerEx.getCommunityHomePath() + "/plugins/InspectionGadgets/test";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user