protected void setUp() throws Exception {
    oldJvmMode = Project.getDefaultOptions().getJvmMode();
    Project.getDefaultOptions().setJvmMode(FastJavaLexer.JVM_50);

    // INIT PROJECT FROM SOURCE AND PATH
    final ProjectMetadata metadata = Utils.getTestProjects().getProject(PROJECT_ID);
    if (metadata == null) {
      fail("Wasn`t able to find project with such id '" + PROJECT_ID + "'");
    }

    project = Utils.createTestRbProject(metadata);
    if (project == null) {
      fail("Failed to create project: " + PROJECT_ID);
    }

    try {
      project.getProjectLoader().build();
    } catch (Exception e) {
      fail("Failed project.load(): " + e);
    }

    assertFalse(
        "Project was not built properly - has errors: "
            + CollectionUtil.toList(
                (project.getProjectLoader().getErrorCollector()).getUserFriendlyErrors()),
        (project.getProjectLoader().getErrorCollector()).hasErrors());
  }
  private void renameMustWork(
      String methodName, String newMethodName, String[] signatures, boolean updateReferences)
      throws Exception {
    final Project project = RwRefactoringTestUtils.createMutableProject(getInitialProject());
    project.getProjectLoader().build();

    BinTypeRef aRef = project.findTypeRefForName("p.A");

    BinTypeRef[] params = RenameMethodTest.convertSingature(project, signatures);
    BinMethod m =
        MethodInvocationRules.getMethodDeclaration(aRef.getBinCIType(), aRef, methodName, params);

    String debugString = RenameMethodTest.filesToString(project);

    assertNotNull(m);

    RenameMethod renamer = new RenameMethod(new NullContext(project), m);
    renamer.setNewName(newMethodName);

    RefactoringStatus status = renamer.checkPreconditions();
    status.merge(renamer.checkUserInput());

    status.merge(renamer.apply());

    if (!status.isOk()) {
      fail("Should have worked" + debugString);
    }
  }
  private void renameMustFail(String methodName, String newMethodName, String[] signatures)
      throws Exception {
    final Project project = RwRefactoringTestUtils.createMutableProject(getInitialProject());
    project.getProjectLoader().build();

    BinTypeRef aRef = project.findTypeRefForName("p.A");

    BinTypeRef[] params = RenameMethodTest.convertSingature(project, signatures);
    BinMethod m =
        MethodInvocationRules.getMethodDeclaration(aRef.getBinCIType(), aRef, methodName, params);

    String debugString = RenameMethodTest.filesToString(project);

    assertNotNull(m);

    RenameMethod renamer = new RenameMethod(new NullContext(project), m);
    renamer.setNewName(newMethodName);

    RefactoringStatus status = renamer.checkPreconditions();
    status.merge(renamer.checkUserInput());

    status.merge(renamer.apply());

    if (status.isOk()) {
      fail("Should have failed" + debugString);
    }

    /*		IType classA= getType(createCUfromTestFile(getPackageP(), "A"), "A");
        RenameMethodRefactoring ref= RenameMethodRefactoring.createInstance(classA.getMethod(methodName, signatures));
        ref.setNewName(newMethodName);
        RefactoringStatus result= performRefactoring(ref);
        assertNotNull("precondition was supposed to fail", result);
    */
  }