From 8a44ee07b6e2278d5ca7a84b3790ca679b7a538e Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 29 Sep 2016 08:57:36 +0200 Subject: [PATCH] cleanup --- .../colors/impl/AbstractColorsScheme.java | 2 -- .../impl/EditorColorsSchemeImplTest.java | 23 +++++++------------ .../editor/EditorColorSchemeTestCase.java | 4 +--- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java index b3ced38e3c07..69415ec6db0a 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java @@ -792,7 +792,6 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial return getFallbackAttributes(fallbackKey.getFallbackAttributeKey()); } - /** * Looks for explicitly specified attributes either in the scheme or its parent scheme. No fallback keys are used. * @@ -808,7 +807,6 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial return myParentScheme instanceof AbstractColorsScheme ? ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedAttributes(key) : null; } - protected static boolean containsValue(@Nullable TextAttributes attributes) { return attributes != null && attributes.containsValue(); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImplTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImplTest.java index 52f02290e4b3..5b223e0818fe 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImplTest.java @@ -31,6 +31,7 @@ import java.util.Arrays; import java.util.Collections; import static com.intellij.openapi.editor.colors.FontPreferencesTest.*; +import static com.intellij.testFramework.Assertions.assertThat; import static java.util.Collections.singletonList; @SuppressWarnings("Duplicates") @@ -198,17 +199,13 @@ public class EditorColorsSchemeImplTest extends EditorColorSchemeTestCase { assertSame(result.second, fallbackAttrs); } - public void testSaveNoInheritanceAndDefaults() throws Exception { - TextAttributes identifierAttrs = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME) - .getAttributes(DefaultLanguageHighlighterColors.IDENTIFIER); - TextAttributes declarationAttrs = identifierAttrs.clone(); - Pair result = - doTestWriteRead(DefaultLanguageHighlighterColors.FUNCTION_DECLARATION, declarationAttrs); - TextAttributes fallbackAttrs = result.first.getAttributes( - DefaultLanguageHighlighterColors.FUNCTION_DECLARATION.getFallbackAttributeKey() - ); - assertEquals(result.second, fallbackAttrs); - assertNotSame(result.second, fallbackAttrs); + public void testSaveNoInheritanceAndDefaults() { + TextAttributes declarationAttrs = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME) + .getAttributes(DefaultLanguageHighlighterColors.IDENTIFIER).clone(); + Pair result = doTestWriteRead(DefaultLanguageHighlighterColors.FUNCTION_DECLARATION, declarationAttrs); + TextAttributes fallbackAttrs = result.first.getAttributes(DefaultLanguageHighlighterColors.FUNCTION_DECLARATION.getFallbackAttributeKey()); + assertThat(result.second).isEqualTo(fallbackAttrs); + assertThat(result.second).isNotSameAs(fallbackAttrs); } public void testSaveInheritanceForEmptyAttrs() throws Exception { @@ -225,7 +222,6 @@ public class EditorColorsSchemeImplTest extends EditorColorSchemeTestCase { assertSame(fallbackAttrs, result.second); } - public void testUpgradeFromVer141() throws Exception { TextAttributesKey constKey = DefaultLanguageHighlighterColors.CONSTANT; TextAttributesKey fallbackKey = constKey.getFallbackAttributeKey(); @@ -279,7 +275,6 @@ public class EditorColorsSchemeImplTest extends EditorColorSchemeTestCase { TextAttributesKey.removeTextAttributesKey("C"); TextAttributesKey.removeTextAttributesKey("D"); } - } public void testIdea152156() throws Exception { @@ -311,6 +306,4 @@ public class EditorColorsSchemeImplTest extends EditorColorSchemeTestCase { TextAttributesKey.removeTextAttributesKey(testKey.getExternalName()); } } - - } diff --git a/platform/testFramework/src/com/intellij/editor/EditorColorSchemeTestCase.java b/platform/testFramework/src/com/intellij/editor/EditorColorSchemeTestCase.java index 5314d25edfa1..6954b4222544 100644 --- a/platform/testFramework/src/com/intellij/editor/EditorColorSchemeTestCase.java +++ b/platform/testFramework/src/com/intellij/editor/EditorColorSchemeTestCase.java @@ -22,7 +22,6 @@ import com.intellij.openapi.editor.colors.impl.AbstractColorsScheme; import com.intellij.openapi.editor.colors.impl.EditorColorsSchemeImpl; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.WriteExternalException; import com.intellij.testFramework.LightPlatformTestCase; import org.jdom.Element; import org.jdom.input.DOMBuilder; @@ -56,8 +55,7 @@ public abstract class EditorColorSchemeTestCase extends LightPlatformTestCase { } @NotNull - protected Pair doTestWriteRead(TextAttributesKey key, TextAttributes attributes) - throws WriteExternalException { + protected Pair doTestWriteRead(@NotNull TextAttributesKey key, @NotNull TextAttributes attributes) { EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); EditorColorsScheme sourceScheme = (EditorColorsScheme)defaultScheme.clone();