Misc: Skip duplicates in navigation tests

This commit is contained in:
Alexey Sedunov
2017-10-20 20:34:12 +03:00
parent 4cc1e22a5a
commit 840825704a
2 changed files with 4 additions and 2 deletions
@@ -8,7 +8,6 @@ class ExpectedChildChild : ExpectedChild()
class SimpleChild : SimpleParent()
// REF: [common] (test).ExpectedChild
// REF: [common] (test).ExpectedChild
// REF: [common] (test).ExpectedChildChild
// REF: [common] (test).SimpleChild
@@ -33,8 +33,10 @@ import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
import com.intellij.util.PathUtil;
import com.intellij.util.containers.MultiMap;
import junit.framework.TestCase;
import kotlin.collections.ArraysKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.asJava.LightClassUtilsKt;
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
import org.jetbrains.kotlin.test.util.ReferenceUtils;
import org.junit.Assert;
@@ -68,8 +70,9 @@ public final class NavigationTestUtils {
Collections.sort(expectedReferences);
if (gotoData != null) {
List<PsiElement> distinctTargets = ArraysKt.distinctBy(gotoData.targets, element -> LightClassUtilsKt.getUnwrapped(element));
// Transform given reference result to strings
List<String> psiElements = Lists.transform(Arrays.asList(gotoData.targets), new Function<PsiElement, String>() {
List<String> psiElements = Lists.transform(distinctTargets, new Function<PsiElement, String>() {
@Override
public String apply(@Nullable PsiElement element) {
Assert.assertNotNull(element);