From 253ca2e646e5ec9c2997eaa8683fb90b76ea3ccf Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 20 Dec 2017 11:52:25 +0100 Subject: [PATCH] fix ConvertingOldDetectionExcludesTest, remove invalid comment --- .../intellij/execution/impl/RunManagerImpl.kt | 1 - .../DetectionExcludesConfigurationImpl.java | 3 +-- ...ldFacetDetectionExcludesConfiguration.java | 4 ++++ .../ConvertingOldDetectionExcludesTest.java | 20 +++++-------------- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.kt b/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.kt index 370610305882..a35cff997d93 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.kt +++ b/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.kt @@ -1040,7 +1040,6 @@ open class RunManagerImpl(internal val project: Project) : RunManagerEx(), Persi } } -// open for Upsource (UpsourceRunManager overrides to disable loadState (empty impl)) @State(name = "ProjectRunConfigurationManager") internal class IprRunManagerImpl(private val project: Project) : PersistentStateComponent { val lastLoadedState = AtomicReference() diff --git a/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurationImpl.java b/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurationImpl.java index b47330ef3498..b87b668bf71c 100644 --- a/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurationImpl.java +++ b/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurationImpl.java @@ -5,7 +5,6 @@ package com.intellij.framework.detection.impl.exclude; import com.intellij.framework.FrameworkType; import com.intellij.framework.detection.DetectionExcludesConfiguration; -import com.intellij.framework.detection.impl.exclude.old.DisabledAutodetectionInfo; import com.intellij.framework.detection.impl.exclude.old.OldFacetDetectionExcludesConfiguration; import com.intellij.openapi.Disposable; import com.intellij.openapi.components.PersistentStateComponent; @@ -96,7 +95,7 @@ public class DetectionExcludesConfigurationImpl extends DetectionExcludesConfigu private void markAsConverted() { myConverted = true; - OldFacetDetectionExcludesConfiguration.getInstance(myProject).loadState(new DisabledAutodetectionInfo()); + OldFacetDetectionExcludesConfiguration.getInstance(myProject).unsetState(); } private void ensureOldSettingsLoaded() { diff --git a/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/old/OldFacetDetectionExcludesConfiguration.java b/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/old/OldFacetDetectionExcludesConfiguration.java index e04773d1d283..465ea58b5557 100644 --- a/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/old/OldFacetDetectionExcludesConfiguration.java +++ b/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/old/OldFacetDetectionExcludesConfiguration.java @@ -48,6 +48,10 @@ public class OldFacetDetectionExcludesConfiguration implements PersistentStateCo myDisabledAutodetectionInfo = state; } + public void unsetState() { + myDisabledAutodetectionInfo = null; + } + @Nullable public ExcludesConfigurationState convert() { if (myDisabledAutodetectionInfo == null || myDisabledAutodetectionInfo.getElements().isEmpty()) { diff --git a/platform/platform-tests/testSrc/com/intellij/framework/detection/ConvertingOldDetectionExcludesTest.java b/platform/platform-tests/testSrc/com/intellij/framework/detection/ConvertingOldDetectionExcludesTest.java index 983f1ef0661b..4fa8c8926ece 100644 --- a/platform/platform-tests/testSrc/com/intellij/framework/detection/ConvertingOldDetectionExcludesTest.java +++ b/platform/platform-tests/testSrc/com/intellij/framework/detection/ConvertingOldDetectionExcludesTest.java @@ -1,17 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package com.intellij.framework.detection; @@ -26,6 +14,8 @@ import com.intellij.testFramework.PlatformTestCase; import com.intellij.testFramework.PsiTestUtil; import com.intellij.testFramework.TempFiles; +import static com.intellij.testFramework.assertions.Assertions.assertThat; + /** * @author nik */ @@ -81,10 +71,10 @@ public class ConvertingOldDetectionExcludesTest extends PlatformTestCase { getNewConfiguration().loadState(state); assertTrue(isFileExcluded(file)); - assertNull(getOldConfiguration().getState()); + assertThat(getOldConfiguration().getState()).isNull(); final ExcludesConfigurationState newState = getNewConfiguration().getState(); assertNotNull(newState); - assertOneElement(newState.getFiles()); + assertThat(newState.getFiles()).hasSize(1); } private boolean isFileExcluded(VirtualFile file) {