void () { boolean[] called = new boolean[1]; getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(ProfileChangeAdapter.TOPIC, new ProfileChangeAdapter() { @Override public void profileActivated(@Nullable InspectionProfile oldProfile, @Nullable InspectionProfile profile) { called[0] = true; } }); final InspectionProfileImpl profile1 = createProfile(); final BaseInspectionProfileManager applicationProfileManager = getApplicationProfileManager(); applicationProfileManager.addProfile(profile1); applicationProfileManager.setRootProfile(PROFILE); assertTrue(called[0]); ProjectInspectionProfileManager projectProfileManager = ProjectInspectionProfileManager.getInstance(getProject()); try { called[0] = false; final InspectionProfileImpl profile2 = createProfile(); projectProfileManager.addProfile(profile2); projectProfileManager.setRootProfile(PROFILE); assertTrue(called[0]); } finally { projectProfileManager.deleteProfile(PROFILE); } }