use of com.siyeh.ig.bugs.EqualsWithItselfInspection in project intellij-community by JetBrains.
the class OfflineInspectionResultViewTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
HighlightDisplayKey key = HighlightDisplayKey.find(UnusedDeclarationInspectionBase.SHORT_NAME);
if (key == null) {
HighlightDisplayKey.register(UnusedDeclarationInspectionBase.SHORT_NAME);
}
final InspectionProfileImpl profile = new InspectionProfileImpl("test") {
@Override
public boolean isToolEnabled(@Nullable final HighlightDisplayKey key, PsiElement element) {
return key != null && Comparing.strEqual(key.toString(), UnusedDeclarationInspectionBase.SHORT_NAME);
}
@Override
@NotNull
public InspectionToolWrapper[] getInspectionTools(PsiElement element) {
return new InspectionToolWrapper[] { myUnusedToolWrapper };
}
@Override
@NotNull
public InspectionProfileModifiableModel getModifiableModel() {
return new InspectionProfileModifiableModel(this) {
@Override
@NotNull
public InspectionToolWrapper[] getInspectionTools(PsiElement element) {
return new InspectionToolWrapper[] { myUnusedToolWrapper };
}
@Override
public boolean isToolEnabled(@Nullable HighlightDisplayKey key, PsiElement element) {
return key != null && Comparing.strEqual(key.toString(), UnusedDeclarationInspectionBase.SHORT_NAME);
}
};
}
};
myView = ViewOfflineResultsAction.showOfflineView(getProject(), parse(), profile, "");
myUnusedToolWrapper = new GlobalInspectionToolWrapper(new UnusedDeclarationInspection());
myDataFlowToolWrapper = new LocalInspectionToolWrapper(new EqualsWithItselfInspection());
final Map<String, Tools> tools = myView.getGlobalInspectionContext().getTools();
for (InspectionToolWrapper tool : ContainerUtil.ar(myUnusedToolWrapper, myDataFlowToolWrapper)) {
profile.addTool(getProject(), tool, new THashMap<>());
tools.put(tool.getShortName(), new ToolsImpl(tool, tool.getDefaultLevel(), true));
tool.initialize(myView.getGlobalInspectionContext());
}
}
Aggregations