// Path: tests/org/udalov/jclang/TestUtils.java
// public static void createOrCompare(@NotNull String actual, @NotNull String expectedFileName) {
//     try {
//         String expected = loadFileContents(expectedFileName);
//         assertEquals(expected, actual);
//     }
//     catch (IOException e) {
//         try {
//             PrintWriter out = new PrintWriter(new File(expectedFileName));
//             out.print(actual);
//             out.close();
//             assertEquals("Expected file wasn't found, it will be created", "", actual);
//         }
//         catch (IOException ee) {
//             ee.printStackTrace();
//             fail(ee.getMessage());
//         }
//     }
// }


import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import static org.udalov.jclang.TestUtils.createOrCompare;
        assertEquals(new File(getTestDeclarationsFile()).getAbsoluteFile(), handle[0].getAbsoluteFile());
    }

    public void testIndexDeclaration() {
        StringWriter sw = new StringWriter();
        final PrintWriter out = new PrintWriter(sw);
        indexTestDeclarations(new AbstractIndexerCallback() {
            @Override
            public void indexDeclaration(@NotNull DeclarationInfo info) {
                Cursor cursor = info.getCursor();
                IndexLocation location = info.getLocation();
                out.print(location.getLine() + ":" + location.getColumn());
                out.print(" " + cursor.getKind().getSpelling());
                out.print(" " + cursor.getType().getKind());
                out.print(" " + nonEmptyCursorSpelling(cursor));
                out.println();

                EntityInfo entityInfo = info.getEntityInfo();
                out.println("  " + entityInfo.getUSR());
                out.println("  " + entityInfo.getKind());
                String spelling = cursor.getSpelling();
                assertEquals(spelling.isEmpty() ? null : spelling, entityInfo.getName());

                if (info.isRedeclaration()) out.println("  redecl");
                if (info.isDefinition()) out.println("  def");
                if (info.isContainer()) out.println("  cnt");
                if (info.isImplicit()) out.println("  implicit");
            }
        });
        out.close();
// Path: tests/org/udalov/jclang/TestUtils.java
// public static void createOrCompare(@NotNull String actual, @NotNull String expectedFileName) {
//     try {
//         String expected = loadFileContents(expectedFileName);
//         assertEquals(expected, actual);
//     }
//     catch (IOException e) {
//         try {
//             PrintWriter out = new PrintWriter(new File(expectedFileName));
//             out.print(actual);
//             out.close();
//             assertEquals("Expected file wasn't found, it will be created", "", actual);
//         }
//         catch (IOException ee) {
//             ee.printStackTrace();
//             fail(ee.getMessage());
//         }
//     }
// }


// Path: tests/org/udalov/jclang/IndexTest.java
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import static org.udalov.jclang.TestUtils.createOrCompare;

        assertEquals(new File(getTestDeclarationsFile()).getAbsoluteFile(), handle[0].getAbsoluteFile());
    }

    public void testIndexDeclaration() {
        StringWriter sw = new StringWriter();
        final PrintWriter out = new PrintWriter(sw);
        indexTestDeclarations(new AbstractIndexerCallback() {
            @Override
            public void indexDeclaration(@NotNull DeclarationInfo info) {
                Cursor cursor = info.getCursor();
                IndexLocation location = info.getLocation();
                out.print(location.getLine() + ":" + location.getColumn());
                out.print(" " + cursor.getKind().getSpelling());
                out.print(" " + cursor.getType().getKind());
                out.print(" " + nonEmptyCursorSpelling(cursor));
                out.println();

                EntityInfo entityInfo = info.getEntityInfo();
                out.println("  " + entityInfo.getUSR());
                out.println("  " + entityInfo.getKind());
                String spelling = cursor.getSpelling();
                assertEquals(spelling.isEmpty() ? null : spelling, entityInfo.getName());

                if (info.isRedeclaration()) out.println("  redecl");
                if (info.isDefinition()) out.println("  def");
                if (info.isContainer()) out.println("  cnt");
                if (info.isImplicit()) out.println("  implicit");
            }
        });
        out.close();
        createOrCompare(sw.toString(), getDir() + "indexDeclaration.txt");