testing GlobalInspectionContextImpl

This commit is contained in:
Dmitry Avdeev
2012-03-29 13:44:00 +04:00
parent e207c327a0
commit 61fb82bc94
@@ -16,6 +16,7 @@
package com.intellij.codeInspection;
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.codeInspection.ex.*;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.profile.codeInspection.InspectionProfileManager;
@@ -27,6 +28,7 @@ import org.jdom.JDOMException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.intellij.testFramework.PlatformTestUtil.assertElementsEqual;
@@ -211,6 +213,18 @@ public class InspectionProfileTest extends LightIdeaTestCase {
assertFalse(profile.isToolEnabled(HighlightDisplayKey.find("bar")));
}
public void testGlobalInspectionContext() throws Exception {
InspectionProfileImpl profile = new InspectionProfileImpl("Foo");
profile.disableAllTools();
profile.enableTool(new UnusedDeclarationInspection().getShortName());
GlobalInspectionContextImpl context = ((InspectionManagerEx)InspectionManager.getInstance(getProject())).createNewGlobalContext(false);
context.setExternalProfile(profile);
context.initializeTools(new ArrayList<Tools>(), new ArrayList<Tools>(), new ArrayList<Tools>());
Map<String,Tools> tools = context.getTools();
assertEquals(1, tools.size());
}
private static LocalInspectionToolWrapper createTool(String s) {
LocalInspectionEP foo = new LocalInspectionEP();
foo.shortName = s;