/*
 * @author max
 */
package com.intellij.psi;

import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.psi.impl.compiled.ClsStubBuilder;
import com.intellij.psi.impl.java.stubs.PsiClassStub;
import com.intellij.psi.impl.java.stubs.impl.PsiClassStubImpl;
import com.intellij.testFramework.LightIdeaTestCase;

import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;

public class ClsBuilderTest extends LightIdeaTestCase {
  public void testSimple() throws Exception {
    doTest("java/util/List.class", "UtilList.txt");
  }

  public void testManyGenerics() throws Exception {
    doTest("java/util/Collections.class", "UtilCollections.txt");
  }

  public void testWithAnnotations() throws Exception {
    doTest("org/jetbrains/annotations/Nullable.class", "Nullable.txt");
  }

  private void doTest(final String classname, final String goldFile) throws IOException {
    final InputStream stream = getClass().getClassLoader().getResourceAsStream(classname);

    final byte[] bytes = FileUtil.adaptiveLoadBytes(stream);
    final PsiClassStub stub = ClsStubBuilder.build(bytes);
    final String butWas = ((PsiClassStubImpl)stub).printTree();
    final String expected = FileUtil.loadTextAndClose(new FileReader(PathManagerEx.getTestDataPath() + "/psi/cls/stubBuilder/" + goldFile));
    assertEquals(expected, butWas);
  }
}
@@ -146,16 +146,66 @@
 leUtil;%0A
+import com.intellij.openapi.util.text.StringUtil;%0A
 import c
@@ -1285,30 +1285,24 @@
 Tree();%0A    
-final 
 String expec
@@ -1420,16 +1420,75 @@
 File));%0A
+    expected = StringUtil.convertLineSeparators(expected);%0A
     asse

fix tests (diff in line separators)