From 83b0c1814900dc3bafd81e2038249366e05b2459 Mon Sep 17 00:00:00 2001 From: thelooter Date: Fri, 8 Nov 2024 19:09:07 +0100 Subject: [PATCH] fix(java): make getVisibilityIcon Method internal Signed-off-by: thelooter --- .../jetbrains_icons/providers/JavaIconProvider.kt | 7 +------ .../providers/JavaIconProviderTest.kt | 12 +++++------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/com/github/catppuccin/jetbrains_icons/providers/JavaIconProvider.kt b/src/main/kotlin/com/github/catppuccin/jetbrains_icons/providers/JavaIconProvider.kt index 578d92a..651a833 100644 --- a/src/main/kotlin/com/github/catppuccin/jetbrains_icons/providers/JavaIconProvider.kt +++ b/src/main/kotlin/com/github/catppuccin/jetbrains_icons/providers/JavaIconProvider.kt @@ -15,7 +15,6 @@ import com.intellij.ui.LayeredIcon import com.intellij.ui.RowIcon import javax.swing.Icon import org.jetbrains.annotations.NotNull -import org.jetbrains.annotations.VisibleForTesting /** Provides icons for Java classes in the IDE. */ class JavaIconProvider : IconProvider() { @@ -101,7 +100,7 @@ class JavaIconProvider : IconProvider() { * @param psiElement The PsiClass to get the visibility icon for. * @return The visibility icon based on the class's modifier, or null if not applicable. */ - private fun getVisibilityIcon(psiElement: PsiClass): Icon? = + internal fun getVisibilityIcon(psiElement: PsiClass): Icon? = when { psiElement.hasModifierProperty(PsiModifier.PUBLIC) -> AllIcons.Nodes.Public psiElement.hasModifierProperty(PsiModifier.PRIVATE) -> AllIcons.Nodes.Private @@ -110,10 +109,6 @@ class JavaIconProvider : IconProvider() { else -> null } - @VisibleForTesting - internal fun getVisibilityIconForTesting(psiElement: PsiClass): Icon? = - getVisibilityIcon(psiElement) - /** * Gets the appropriate Java icon based on the class type. * diff --git a/src/test/kotlin/com/github/com/catppuccin/jetbrains_icons/providers/JavaIconProviderTest.kt b/src/test/kotlin/com/github/com/catppuccin/jetbrains_icons/providers/JavaIconProviderTest.kt index c96dc60..d42ca02 100644 --- a/src/test/kotlin/com/github/com/catppuccin/jetbrains_icons/providers/JavaIconProviderTest.kt +++ b/src/test/kotlin/com/github/com/catppuccin/jetbrains_icons/providers/JavaIconProviderTest.kt @@ -281,9 +281,7 @@ class JavaIconProviderTest : LightJavaCodeInsightFixtureTestCase5() { .trimIndent(), ) - val icon = runInEdtAndGet { - provider.getVisibilityIconForTesting(fixture.findClass("PublicClass")) - } + val icon = runInEdtAndGet { provider.getVisibilityIcon(fixture.findClass("PublicClass")) } assertEquals(AllIcons.Nodes.Public, icon) } @@ -302,7 +300,7 @@ class JavaIconProviderTest : LightJavaCodeInsightFixtureTestCase5() { ) val icon = runInEdtAndGet { - provider.getVisibilityIconForTesting(fixture.findClass("OuterClass.PrivateClass")) + provider.getVisibilityIcon(fixture.findClass("OuterClass.PrivateClass")) } assertEquals(AllIcons.Nodes.Private, icon) @@ -322,7 +320,7 @@ class JavaIconProviderTest : LightJavaCodeInsightFixtureTestCase5() { ) val icon = runInEdtAndGet { - provider.getVisibilityIconForTesting(fixture.findClass("OuterClass.ProtectedClass")) + provider.getVisibilityIcon(fixture.findClass("OuterClass.ProtectedClass")) } assertEquals(AllIcons.Nodes.Protected, icon) @@ -340,7 +338,7 @@ class JavaIconProviderTest : LightJavaCodeInsightFixtureTestCase5() { ) val icon = runInEdtAndGet { - provider.getVisibilityIconForTesting(fixture.findClass("PackagePrivateClass")) + provider.getVisibilityIcon(fixture.findClass("PackagePrivateClass")) } assertEquals(AllIcons.Nodes.PackageLocal, icon) @@ -352,7 +350,7 @@ class JavaIconProviderTest : LightJavaCodeInsightFixtureTestCase5() { // Create a mock PsiClass that returns null for its modifier list val mockClass = mock { on { modifierList } doReturn null } - val icon = runInEdtAndGet { provider.getVisibilityIconForTesting(mockClass) } + val icon = runInEdtAndGet { provider.getVisibilityIcon(mockClass) } assertNull(icon) }