void () { replaceService(myProject, ExternalSystemProjectTrackerSettings.class, new AutoImportProjectTrackerSettings(), () -> { ExternalSystemProjectTrackerSettings projectTrackerSettings = ExternalSystemProjectTrackerSettings.getInstance(myProject); MavenWorkspaceSettingsComponent workspaceSettingsComponent = loadWorkspaceComponent( """ <MavenWorkspaceSettings> <option name="importingSettings"> <MavenImportingSettings> <option name="importAutomatically" value="true" /> </MavenImportingSettings> </option> </MavenWorkspaceSettings> """); assertFalse(workspaceSettingsComponent.getSettings().getImportingSettings().isImportAutomatically()); assertEquals(ExternalSystemProjectTrackerSettings.AutoReloadType.ALL, projectTrackerSettings.getAutoReloadType()); assertEquals("<MavenWorkspaceSettings />", storeWorkspaceComponent(workspaceSettingsComponent)); }); replaceService(myProject, ExternalSystemProjectTrackerSettings.class, new AutoImportProjectTrackerSettings(), () -> { ExternalSystemProjectTrackerSettings projectTrackerSettings = ExternalSystemProjectTrackerSettings.getInstance(myProject); MavenWorkspaceSettingsComponent workspaceSettingsComponent = loadWorkspaceComponent( """ <MavenWorkspaceSettings> <option name="importingSettings"> <MavenImportingSettings> <option name="importAutomatically" value="false" /> </MavenImportingSettings> </option> </MavenWorkspaceSettings> """); assertFalse(workspaceSettingsComponent.getSettings().getImportingSettings().isImportAutomatically()); assertEquals(ExternalSystemProjectTrackerSettings.AutoReloadType.SELECTIVE, projectTrackerSettings.getAutoReloadType()); assertEquals("<MavenWorkspaceSettings />", storeWorkspaceComponent(workspaceSettingsComponent)); }); replaceService(myProject, ExternalSystemProjectTrackerSettings.class, new AutoImportProjectTrackerSettings(), () -> { ExternalSystemProjectTrackerSettings projectTrackerSettings = ExternalSystemProjectTrackerSettings.getInstance(myProject); MavenWorkspaceSettingsComponent workspaceSettingsComponent = loadWorkspaceComponent("<MavenWorkspaceSettings />"); assertFalse(workspaceSettingsComponent.getSettings().getImportingSettings().isImportAutomatically()); assertEquals(ExternalSystemProjectTrackerSettings.AutoReloadType.SELECTIVE, projectTrackerSettings.getAutoReloadType()); assertEquals("<MavenWorkspaceSettings />", storeWorkspaceComponent(workspaceSettingsComponent)); }); }