void () { List<InspectionToolWrapper<?, ?>> list = new ArrayList<>(); list.add(createTool("foo", true)); InspectionToolsSupplier.Simple toolSupplier = new InspectionToolsSupplier.Simple(list); Disposer.register(getTestRootDisposable(), toolSupplier); InspectionProfileImpl profile = createProfile(toolSupplier); List<ScopeToolState> tools = profile.getAllTools(); assertEquals(1, tools.size()); assertTrue(profile.isToolEnabled(HighlightDisplayKey.find("foo"))); assertTrue(profile.getToolDefaultState("foo", getProject()).isEnabled()); profile.modifyProfile(it -> { it.lockProfile(true); it.initInspectionTools(getProject()); // todo commit should take care of initialization }); assertEquals(""" <profile version="1.0" is_locked="true"> <option name="myName" value="Foo" /> <inspection_tool class="foo" enabled="true" level="ERROR" enabled_by_default="true" /> </profile>""", serialize(profile)); Element element = profile.writeScheme(); list.add(createTool("bar", true)); list.add(createTool("disabled", false)); profile = createProfile(toolSupplier); profile.readExternal(element); tools = profile.getAllTools(); assertEquals(3, tools.size()); assertTrue(profile.isProfileLocked()); assertFalse(profile.isToolEnabled(HighlightDisplayKey.find("bar"))); assertFalse(profile.isToolEnabled(HighlightDisplayKey.find("disabled"))); assertFalse(profile.getToolDefaultState("bar", getProject()).isEnabled()); assertFalse(profile.getToolDefaultState("disabled", getProject()).isEnabled()); assertEquals(""" <profile version="1.0" is_locked="true"> <option name="myName" value="Foo" /> <inspection_tool class="bar" enabled="false" level="ERROR" enabled_by_default="false" /> <inspection_tool class="disabled" enabled="false" level="ERROR" enabled_by_default="false" /> <inspection_tool class="foo" enabled="true" level="ERROR" enabled_by_default="true" /> </profile>""", serialize(profile)); }