public void testExtractInterfaceFromInterface2() throws Exception {
    String className = "A";
    String extendingInterfaceName = "I1";
    String newInterfaceName = "B";

    IType clas =
        getType(createCUfromTestFile(getPackageP(), getTopLevelTypeName(className)), className);
    ICompilationUnit cu = clas.getCompilationUnit();
    IPackageFragment pack = (IPackageFragment) cu.getParent();

    getType(
        createCUfromTestFile(getPackageP(), getTopLevelTypeName(extendingInterfaceName)),
        extendingInterfaceName);

    IPackageFragmentRoot root = RefactoringTestSetup.getDefaultSourceFolder();
    assertNotNull(root);
    IPackageFragment p2 = root.createPackageFragment("p2", true, null);
    getType(createCUfromTestFile(p2, getTopLevelTypeName("I2")), "I2");

    ExtractInterfaceProcessor processor =
        new ExtractInterfaceProcessor(
            clas, JavaPreferencesSettings.getCodeGenerationSettings(clas.getJavaProject()));
    Refactoring ref = new ProcessorBasedRefactoring(processor);

    processor.setTypeName(newInterfaceName);
    assertEquals(
        "interface name should be accepted",
        RefactoringStatus.OK,
        processor.checkTypeName(newInterfaceName).getSeverity());

    IMember[] extractableMembers = processor.getExtractableMembers();
    final IMember[] members = new IMember[extractableMembers.length - 1];
    List<IMember> list = new ArrayList<>();
    for (IMember iMember : extractableMembers) {
      if (!(iMember instanceof IField)) {
        list.add(iMember);
      }
    }
    processor.setExtractedMembers(list.toArray(members));
    processor.setReplace(true);
    processor.setAnnotations(false);
    RefactoringStatus performRefactoring = performRefactoring(ref);
    assertEquals("was supposed to pass", null, performRefactoring);
    assertEqualLines(
        "incorrect changes in " + className,
        getFileContents(getOutputTestFileName(className)),
        cu.getSource());

    ICompilationUnit interfaceCu = pack.getCompilationUnit(newInterfaceName + ".java");
    assertEqualLines(
        "incorrect interface created",
        getFileContents(getOutputTestFileName(newInterfaceName)),
        interfaceCu.getSource());
  }
  protected void setUp() throws Exception {
    super.setUp();
    fProject = new SWTTestProject();
    IType control = fProject.getProject().findType("org.eclipse.swt.widgets.Control");

    ExtractInterfaceProcessor processor =
        new ExtractInterfaceProcessor(
            control, JavaPreferencesSettings.getCodeGenerationSettings(fProject.getProject()));
    fRefactoring = new ProcessorBasedRefactoring(processor);

    IMethod[] methods = control.getMethods();
    List extractedMembers = new ArrayList();
    for (int i = 0; i < methods.length; i++) {
      IMethod method = methods[i];
      int flags = method.getFlags();
      if (Flags.isPublic(flags) && !Flags.isStatic(flags) && !method.isConstructor()) {
        extractedMembers.add(method);
      }
    }
    processor.setTypeName("IControl");
    processor.setExtractedMembers(
        (IMember[]) extractedMembers.toArray(new IMember[extractedMembers.size()]));
    processor.setReplace(true);
  }