@@ -0,0 +1,3780 @@
+// Copyright 2000-2018 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.%0Apackage com.intellij.ui;%0A%0Aimport com.intellij.openapi.project.Project;%0Aimport com.intellij.psi.*;%0Aimport com.intellij.psi.search.GlobalSearchScope;%0Aimport com.intellij.psi.xml.XmlTag;%0Aimport com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;%0Aimport com.intellij.util.IncorrectOperationException;%0Aimport com.intellij.util.text.ElementPresentation;%0A%0Aimport java.io.File;%0A%0Apublic class ElementPresentationTest extends LightCodeInsightFixtureTestCase %7B%0A  private PsiClass OBJECT_CLASS;%0A%0A  @Override%0A  protected void setUp() throws Exception %7B%0A    super.setUp();%0A    Project project = getProject();%0A    OBJECT_CLASS = JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_LANG_OBJECT, GlobalSearchScope.allScope(project));%0A  %7D%0A%0A  public void testPackage() %7B%0A    PsiPackage javaLang = JavaDirectoryService.getInstance().getPackage(OBJECT_CLASS.getContainingFile().getContainingDirectory());%0A    ElementPresentation presentation = ElementPresentation.forElement(javaLang);%0A    assertEquals(%22java.lang%22, presentation.getQualifiedName());%0A    assertEquals(%22java.lang%22, presentation.getName());%0A    assertEquals(%22%22, presentation.getComment());%0A    assertSame(ElementPresentation.Noun.PACKAGE, presentation.getKind());%0A%0A    PsiPackage defaultPackage = javaLang.getParentPackage().getParentPackage();%0A    presentation = ElementPresentation.forElement(defaultPackage);%0A    assertEquals(%22%3Cdefault%3E%22, presentation.getQualifiedName());%0A    assertEquals(%22%3Cdefault%3E%22, presentation.getName());%0A    assertEquals(%22%22, presentation.getComment());%0A  %7D%0A%0A  public void testDirectory() %7B%0A    PsiDirectory javaLang = OBJECT_CLASS.getContainingFile().getContainingDirectory();%0A    ElementPresentation presentation = ElementPresentation.forElement(javaLang);%0A    checkFSPresentation(presentation, %22/java/lang%22, %22lang%22, %22/java%22);%0A    assertSame(ElementPresentation.Noun.DIRECTORY, presentation.getKind());%0A  %7D%0A%0A  public void testFile() %7B%0A    PsiFile file = OBJECT_CLASS.getContainingFile();%0A    ElementPresentation presentation = ElementPresentation.forElement(file);%0A    checkFSPresentation(presentation, %22/java/lang/Object.class%22, %22Object.class%22, %22/java/lang%22);%0A    assertSame(ElementPresentation.Noun.FILE, presentation.getKind());%0A  %7D%0A%0A  public void testXmlTag() throws IncorrectOperationException %7B%0A    XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText(%22%3CtagName a=%5C%22b%5C%22%3Econtent%3C/tagName%3E%22);%0A    ElementPresentation presentation = ElementPresentation.forElement(tag);%0A    assertEquals(%22%3CtagName%3E%22, presentation.getQualifiedName());%0A    assertEquals(%22%3CtagName%3E%22, presentation.getName());%0A    assertEquals(%22%22, presentation.getComment());%0A    assertSame(ElementPresentation.Noun.XML_TAG, presentation.getKind());%0A  %7D%0A%0A  public void testClass() %7B%0A    ElementPresentation presentation = ElementPresentation.forElement(OBJECT_CLASS);%0A    assertEquals(CommonClassNames.JAVA_LANG_OBJECT, presentation.getQualifiedName());%0A    assertEquals(%22Object%22, presentation.getName());%0A    assertEquals(%22java.lang%22, presentation.getComment());%0A  %7D%0A%0A  private static void checkFSPresentation(ElementPresentation presentation, String fqEnd, String name, String commentEnd) %7B%0A    fqEnd = fqEnd.replace('/', File.separatorChar);%0A    commentEnd = commentEnd.replace('/', File.separatorChar);%0A    String qualifiedName = presentation.getQualifiedName();%0A    assertTrue(qualifiedName + %22.endsWith(%22 + fqEnd + %22)%22, qualifiedName.endsWith(fqEnd));%0A    assertEquals(name, presentation.getName());%0A    String comment = presentation.getComment();%0A    assertTrue(comment + %22.endsWith(%22 + commentEnd + %22)%22, comment.endsWith(commentEnd));%0A  %7D%0A%7D%0A

move ElementPresentationTest