org.eclipse.jdt.core.ICompilationUnit

Here are the examples of the java api class org.eclipse.jdt.core.ICompilationUnit taken from open source projects.

1. RenameTypeTest#test51()

Project: che
File: RenameTypeTest.java
@Test
public void test51() throws Exception {
    IPackageFragment packageP1 = getRoot().createPackageFragment("p1", true, null);
    createCUfromTestFile(packageP1, "C");
    ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
    IType classA = getType(cu, "A");
    assertEquals("was supposed to pass", null, performRefactoring(createRefactoringDescriptor(classA, "B")));
    ICompilationUnit newcu = getPackageP().getCompilationUnit("B.java");
    ICompilationUnit newcuC = packageP1.getCompilationUnit("C.java");
    assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("B")), newcu.getSource());
    assertEqualLines("invalid renaming C", getFileContents(getOutputTestFileName("C")), newcuC.getSource());
}

2. RenameTypeTest#test46()

Project: che
File: RenameTypeTest.java
@Test
public void test46() throws Exception {
    IPackageFragment packageP1 = getRoot().createPackageFragment("p1", true, null);
    createCUfromTestFile(packageP1, "C");
    ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
    IType classA = getType(cu, "A");
    assertEquals("was supposed to pass", null, performRefactoring(createRefactoringDescriptor(classA, "B")));
    ICompilationUnit newcu = getPackageP().getCompilationUnit("B.java");
    ICompilationUnit newcuC = packageP1.getCompilationUnit("C.java");
    assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("B")), newcu.getSource());
    assertEqualLines("invalid renaming C", getFileContents(getOutputTestFileName("C")), newcuC.getSource());
}

3. RenameTypeTest#test31()

Project: che
File: RenameTypeTest.java
@Test
public void test31() throws Exception {
    createCUfromTestFile(getPackageP(), "AA");
    ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
    IType classA = getType(cu, "A");
    assertEquals("was supposed to pass", null, performRefactoring(createRefactoringDescriptor(classA, "B")));
    ICompilationUnit newcu = getPackageP().getCompilationUnit("B.java");
    ICompilationUnit newcuAA = getPackageP().getCompilationUnit("AA.java");
    assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("B")), newcu.getSource());
    assertEqualLines("invalid renaming AA", getFileContents(getOutputTestFileName("AA")), newcuAA.getSource());
}

4. RenameTypeTest#test30()

Project: che
File: RenameTypeTest.java
@Test
public void test30() throws Exception {
    createCUfromTestFile(getPackageP(), "AA");
    ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
    IType classA = getType(cu, "A");
    assertEquals("was supposed to pass", null, performRefactoring(createRefactoringDescriptor(classA, "B")));
    ICompilationUnit newcu = getPackageP().getCompilationUnit("B.java");
    ICompilationUnit newcuAA = getPackageP().getCompilationUnit("AA.java");
    assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("B")), newcu.getSource());
    assertEqualLines("invalid renaming AA", getFileContents(getOutputTestFileName("AA")), newcuAA.getSource());
}

5. RenameTypeTest#test29()

Project: che
File: RenameTypeTest.java
@Test
public void test29() throws Exception {
    IPackageFragment packageP1 = getRoot().createPackageFragment("p1", true, null);
    createCUfromTestFile(packageP1, "C");
    ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
    IType classA = getType(cu, "A");
    assertEquals("was supposed to pass", null, performRefactoring(createRefactoringDescriptor(classA, "B")));
    ICompilationUnit newcu = getPackageP().getCompilationUnit("B.java");
    ICompilationUnit newcuC = packageP1.getCompilationUnit("C.java");
    assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("B")), newcu.getSource());
    assertEqualLines("invalid renaming C", getFileContents(getOutputTestFileName("C")), newcuC.getSource());
}

6. MemberVisibilityAdjustor#thresholdTypeToField()

Project: che
File: MemberVisibilityAdjustor.java
/**
	 * Returns the visibility threshold from a type to a field.
	 *
	 * @param referencing the referencing type
	 * @param referenced the referenced field
	 * @param monitor the progress monitor to use
	 * @return the visibility keyword corresponding to the threshold, or <code>null</code> for default visibility
	 * @throws JavaModelException if the java elements could not be accessed
	 */
private ModifierKeyword thresholdTypeToField(final IType referencing, final IField referenced, final IProgressMonitor monitor) throws JavaModelException {
    ModifierKeyword keyword = ModifierKeyword.PUBLIC_KEYWORD;
    final ICompilationUnit referencedUnit = referenced.getCompilationUnit();
    if (referenced.getDeclaringType().equals(referencing))
        keyword = ModifierKeyword.PRIVATE_KEYWORD;
    else {
        final ITypeHierarchy hierarchy = getTypeHierarchy(referencing, new SubProgressMonitor(monitor, 1));
        final IType[] types = hierarchy.getSupertypes(referencing);
        IType superType = null;
        for (int index = 0; index < types.length; index++) {
            superType = types[index];
            if (superType.equals(referenced.getDeclaringType())) {
                keyword = ModifierKeyword.PROTECTED_KEYWORD;
                return keyword;
            }
        }
    }
    final ICompilationUnit typeUnit = referencing.getCompilationUnit();
    if (referencedUnit != null && referencedUnit.equals(typeUnit))
        keyword = ModifierKeyword.PRIVATE_KEYWORD;
    else if (referencedUnit != null && typeUnit != null && referencedUnit.getParent().equals(typeUnit.getParent()))
        keyword = null;
    return keyword;
}

7. JavaZipModule#getJavaCompletionProposals()

Project: Pydev
File: JavaZipModule.java
/**
     * Gets tuples with the java element and the corresponding completion proposal for that element.
     * 
     * @param contents the contents that should be set for doing the code-completion
     * @param completionOffset the offset where the code completion should be requested
     * @param filterCompletionName if specified, only return matches from elements that have the name passed (otherwise it should be null)
     * @return a list of tuples corresponding to the element and the proposal for the gotten elements
     * @throws JavaModelException
     */
@Override
protected List<Tuple<IJavaElement, CompletionProposal>> getJavaCompletionProposals(String contents, int completionOffset, final String filterCompletionName) throws JavaModelException {
    final List<Tuple<IJavaElement, CompletionProposal>> ret = new ArrayList<Tuple<IJavaElement, CompletionProposal>>();
    IClasspathEntry entries[] = getClasspathEntries();
    //Using old version for compatibility with eclipse 3.2
    ICompilationUnit unit = new WorkingCopyOwner() {
    }.newWorkingCopy(name, entries, null, new NullProgressMonitor());
    unit.getBuffer().setContents(contents);
    CompletionProposalCollector collector = createCollector(filterCompletionName, ret, unit);
    //fill the completions while searching it
    unit.codeComplete(completionOffset, collector);
    return ret;
}

8. JUnitImplCommand#execute()

Project: eclim
File: JUnitImplCommand.java
@Override
public Object execute(CommandLine commandLine) throws Exception {
    String projectName = commandLine.getValue(Options.PROJECT_OPTION);
    String file = commandLine.getValue(Options.FILE_OPTION);
    IJavaProject javaProject = JavaUtils.getJavaProject(projectName);
    ICompilationUnit test = JavaUtils.getCompilationUnit(javaProject, file);
    ICompilationUnit src = JUnitUtils.findClass(javaProject, test.getTypes()[0]);
    if (src == null) {
        return Services.getMessage("junit.testing.class.not.found");
    }
    RefactoringASTParser parser = new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL);
    CompilationUnit cu = parser.parse(src, true);
    ITypeBinding base = ASTNodeSearchUtil.getTypeDeclarationNode(src.getTypes()[0], cu).resolveBinding();
    this.base.set(base);
    return super.execute(commandLine);
}

9. CodeCompleteCommand#getCompletionResults()

Project: eclim
File: CodeCompleteCommand.java
@Override
protected List<CodeCompleteResult> getCompletionResults(CommandLine commandLine, String project, String file, int offset) throws Exception {
    ICompilationUnit src = JavaUtils.getCompilationUnit(project, file);
    CompletionProposalCollector collector = new CompletionProposalCollector(src);
    src.codeComplete(offset, collector);
    IJavaCompletionProposal[] proposals = collector.getJavaCompletionProposals();
    ArrayList<CodeCompleteResult> results = new ArrayList<CodeCompleteResult>();
    for (IJavaCompletionProposal proposal : proposals) {
        results.add(createCompletionResult(proposal));
    }
    Collections.sort(results, COMPLETION_COMPARATOR);
    this.collector.set(collector);
    return results;
}

10. RenameVirtualMethodInClassTest#test18()

Project: che
File: RenameVirtualMethodInClassTest.java
@Test
public void test18() throws Exception {
    ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
    ICompilationUnit cuC = createCUfromTestFile(getPackageP(), "C");
    IType classB = getType(cu, "B");
    IMethod method = classB.getMethod("m", new String[] { "I" });
    final RenameJavaElementDescriptor descriptor = RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_METHOD);
    descriptor.setJavaElement(method);
    descriptor.setNewName("kk");
    descriptor.setUpdateReferences(true);
    final RefactoringStatus status = new RefactoringStatus();
    final Refactoring refactoring = descriptor.createRefactoring(status);
    assertNotNull("Refactoring should not be null", refactoring);
    assertTrue("status should be ok", status.isOK());
    assertEquals("was supposed to pass", null, performRefactoring(refactoring));
    assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("A")), cu.getSource());
    assertEqualLines("invalid renaming C", getFileContents(getOutputTestFileName("C")), cuC.getSource());
}

11. RenameTypeTest#test20()

Project: che
File: RenameTypeTest.java
@Test
public void test20() throws Exception {
    //printTestDisabledMessage("failb because of bug#9479");
    //if (true)
    //	return;
    IPackageFragment packageA = getRoot().createPackageFragment("A", true, null);
    ICompilationUnit cu = createCUfromTestFile(packageA, "A");
    IType classA = getType(cu, "A");
    assertEquals("was supposed to pass", null, performRefactoring(createRefactoringDescriptor(classA, "B")));
    ICompilationUnit newcu = packageA.getCompilationUnit("B.java");
    assertEqualLines("invalid renaming", getFileContents(getOutputTestFileName("B")), newcu.getSource());
}

12. RenameStaticMethodTest#test11()

Project: che
File: RenameStaticMethodTest.java
@Test
public void test11() throws Exception {
    //		printTestDisabledMessage("bug 40452");
    //		if (true)	return;
    IPackageFragment packageA = getRoot().createPackageFragment("a", false, new NullProgressMonitor());
    IPackageFragment packageB = getRoot().createPackageFragment("b", false, new NullProgressMonitor());
    ICompilationUnit cuA = createCUfromTestFile(packageA, "A");
    ICompilationUnit cuB = createCUfromTestFile(packageB, "B");
    IType classA = getType(cuA, "A");
    IMethod method = classA.getMethod("method2", new String[0]);
    RenameJavaElementDescriptor descriptor = RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_METHOD);
    descriptor.setUpdateReferences(true);
    descriptor.setJavaElement(method);
    descriptor.setNewName("fred");
    assertEquals("was supposed to pass", null, performRefactoring(descriptor));
    assertEqualLines("invalid renaming in A", getFileContents(getOutputTestFileName("A")), cuA.getSource());
    assertEqualLines("invalid renaming in B", getFileContents(getOutputTestFileName("B")), cuB.getSource());
}

13. RenameStaticMethodTest#test10()

Project: che
File: RenameStaticMethodTest.java
@Test
public void test10() throws Exception {
    //		printTestDisabledMessage("bug 40628");
    //		if (true)	return;
    ICompilationUnit cuA = createCUfromTestFile(getPackageP(), "A");
    ICompilationUnit cuB = createCUfromTestFile(getPackageP(), "B");
    IType classB = getType(cuB, "B");
    IMethod method = classB.getMethod("method", new String[0]);
    RenameJavaElementDescriptor descriptor = RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_METHOD);
    descriptor.setUpdateReferences(true);
    descriptor.setJavaElement(method);
    descriptor.setNewName("newmethod");
    assertEquals("was supposed to pass", null, performRefactoring(descriptor));
    assertEqualLines("invalid renaming in A", getFileContents(getOutputTestFileName("A")), cuA.getSource());
    assertEqualLines("invalid renaming in B", getFileContents(getOutputTestFileName("B")), cuB.getSource());
}

14. RenameRefactoringTest#testApplyLinkedRename()

Project: che
File: RenameRefactoringTest.java
@Test
public void testApplyLinkedRename() throws Exception {
    StringBuilder b = new StringBuilder();
    b.append("package p;\n");
    b.append("public class A{}\n");
    ICompilationUnit unit = getPackageP().createCompilationUnit("A.java", b.toString(), false, null);
    IType type = unit.getAllTypes()[0];
    RenameRefactoringSession refactoring = manager.createRenameRefactoring(type, unit, b.indexOf("A"), true);
    assertThat(refactoring).isNotNull();
    assertThat(refactoring.getSessionId()).isNotNull().isNotEmpty();
    LinkedRenameRefactoringApply apply = new DtoServerImpls.LinkedRenameRefactoringApplyImpl();
    apply.setSessionId(refactoring.getSessionId());
    apply.setNewName("Test");
    RefactoringStatus status = manager.applyLinkedRename(apply);
    assertThat(status).isNotNull();
    assertThat(status.getSeverity()).isEqualTo(RefactoringStatus.OK);
    assertThat(unit.exists()).isFalse();
    ICompilationUnit newUnit = getPackageP().getCompilationUnit("Test.java");
    assertThat(newUnit.exists()).isTrue();
}

15. RenamePrivateMethodTest#test18()

Project: che
File: RenamePrivateMethodTest.java
@Test
public void test18() throws Exception {
    ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
    ICompilationUnit cuC = createCUfromTestFile(getPackageP(), "C");
    IType classB = getType(cu, "B");
    RenameMethodProcessor processor = new RenameNonVirtualMethodProcessor(classB.getMethod("m", new String[] { "I" }));
    RenameRefactoring refactoring = new RenameRefactoring(processor);
    processor.setNewElementName("kk");
    assertEquals("was supposed to pass", null, performRefactoring(refactoring));
    assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("A")), cu.getSource());
    assertEqualLines("invalid renaming C", getFileContents(getOutputTestFileName("C")), cuC.getSource());
}

16. RenameParametersTest#helper1()

Project: che
File: RenameParametersTest.java
private void helper1(String[] newNames, String[] signature) throws Exception {
    ICompilationUnit cu = createCUfromTestFile(getPackageP(), true, true);
    IType classA = getType(cu, "A");
    IMethod method = classA.getMethod("m", signature);
    Assert.assertTrue("refactoring not available", RefactoringAvailabilityTester.isChangeSignatureAvailable(method));
    ChangeSignatureProcessor processor = new ChangeSignatureProcessor(method);
    Refactoring ref = new ProcessorBasedRefactoring(processor);
    //ref.setUpdateReferences(updateReferences);
    //ref.setNewParameterNames(newNames);
    //ref.setNewNames(createRenamings(method, newNames));
    modifyInfos(processor.getParameterInfos(), newNames);
    RefactoringStatus result = performRefactoring(ref);
    Assert.assertEquals("precondition was supposed to pass", null, result);
    IPackageFragment pack = (IPackageFragment) cu.getParent();
    String newCuName = getSimpleTestFileName(true, true);
    ICompilationUnit newcu = pack.getCompilationUnit(newCuName);
    Assert.assertTrue(newCuName + " does not exist", newcu.exists());
    Assert.assertEquals("invalid renaming", getFileContents(getTestFileName(true, false)).length(), newcu.getSource().length());
    assertEqualLines("invalid renaming", getFileContents(getTestFileName(true, false)), newcu.getSource());
}

17. RenameNonPrivateFieldTest#testEnumConst()

Project: che
File: RenameNonPrivateFieldTest.java
@Test
public void testEnumConst() throws Exception {
    //bug 77619
    IPackageFragment test1 = getRoot().createPackageFragment("test1", true, null);
    ICompilationUnit cuC = null;
    ICompilationUnit cuB = createCUfromTestFile(test1, "B");
    cuC = createCUfromTestFile(getRoot().getPackageFragment(""), "C");
    helper2("RED", "REDDISH");
    assertEqualLines("invalid renaming", getFileContents(getOutputTestFileName("B")), cuB.getSource());
    assertEqualLines("invalid renaming", getFileContents(getOutputTestFileName("C")), cuC.getSource());
}

18. RenameNonPrivateFieldTest#testStaticImport()

Project: che
File: RenameNonPrivateFieldTest.java
@Test
public void testStaticImport() throws Exception {
    //bug 77622
    IPackageFragment test1 = getRoot().createPackageFragment("test1", true, null);
    ICompilationUnit cuC = null;
    ICompilationUnit cuB = createCUfromTestFile(test1, "B");
    cuC = createCUfromTestFile(getRoot().getPackageFragment(""), "C");
    helper2("PI", "e");
    assertEqualLines("invalid renaming", getFileContents(getOutputTestFileName("B")), cuB.getSource());
    assertEqualLines("invalid renaming", getFileContents(getOutputTestFileName("C")), cuC.getSource());
}

19. ConvertIterableLoopQuickFixTest#testBug176595()

Project: che
File: ConvertIterableLoopQuickFixTest.java
@Test
public void testBug176595() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("import java.util.Iterator;\n");
    buf.append("import java.util.List;\n");
    buf.append("public class E1 {\n");
    buf.append("    public void foo(List<Object> list1, List list2) {\n");
    buf.append("        for (Iterator<?> it1 = list1.iterator(), it2 = null; it1.hasNext();) {\n");
    buf.append("                Object e1 = it1.next();\n");
    buf.append("                System.out.println(it2.toString());\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E1.java", buf.toString(), false, null);
    fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
}

20. ConvertIterableLoopQuickFixTest#testBug129508_4()

Project: che
File: ConvertIterableLoopQuickFixTest.java
@Test
public void testBug129508_4() throws Exception {
    IPackageFragment pack = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import java.util.Iterator;\n");
    buf.append("import java.util.List;\n");
    buf.append("public class E1 {\n");
    buf.append("    public void foo(List<Integer> list) {\n");
    buf.append("       for (Iterator<Integer> iter = list.iterator(); iter.hasNext();) {\n");
    buf.append("            Integer id = iter.next();\n");
    buf.append("            Integer id2= iter.next();\n");
    buf.append("       } \n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit unit = pack.createCompilationUnit("E1.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, unit);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

21. ConvertIterableLoopQuickFixTest#testBug129508_3()

Project: che
File: ConvertIterableLoopQuickFixTest.java
@Test
public void testBug129508_3() throws Exception {
    IPackageFragment pack = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import java.util.Iterator;\n");
    buf.append("import java.util.List;\n");
    buf.append("public class E1 {\n");
    buf.append("    public void foo(List<Integer> list) {\n");
    buf.append("       for (Iterator<Integer> iter = list.iterator(); iter.hasNext();) {\n");
    buf.append("            Integer id = iter.next();\n");
    buf.append("            boolean x= iter.hasNext();\n");
    buf.append("       } \n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit unit = pack.createCompilationUnit("E1.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, unit);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

22. ConvertIterableLoopQuickFixTest#testBug129508_2()

Project: che
File: ConvertIterableLoopQuickFixTest.java
@Test
public void testBug129508_2() throws Exception {
    IPackageFragment pack = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import java.util.Iterator;\n");
    buf.append("import java.util.List;\n");
    buf.append("public class E1 {\n");
    buf.append("    public void foo(List<Integer> list) {\n");
    buf.append("       for (Iterator<Integer> iter = list.iterator(); iter.hasNext();) {\n");
    buf.append("            Integer id = iter.next();\n");
    buf.append("            iter.next();\n");
    buf.append("       } \n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit unit = pack.createCompilationUnit("E1.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, unit);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

23. ConvertIterableLoopQuickFixTest#testBug129508_1()

Project: che
File: ConvertIterableLoopQuickFixTest.java
@Test
public void testBug129508_1() throws Exception {
    IPackageFragment pack = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import java.util.Iterator;\n");
    buf.append("import java.util.List;\n");
    buf.append("public class E1 {\n");
    buf.append("    public void foo(List<Integer> list) {\n");
    buf.append("       for (Iterator<Integer> iter = list.iterator(); iter.hasNext();) {\n");
    buf.append("            Integer id = iter.next();\n");
    buf.append("            iter.remove();\n");
    buf.append("       } \n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit unit = pack.createCompilationUnit("E1.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, unit);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

24. ConvertForLoopQuickFixTest#testBug231575_1()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBug231575_1() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E1 {\n");
    buf.append("    private Object[] array;\n");
    buf.append("    public void method(E1 copy) {\n");
    buf.append("        for (int i = 0; i < copy.array.length; i++) {\n");
    buf.append("            array[i].equals(null);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E1.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

25. ConvertForLoopQuickFixTest#testBug214340_2()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBug214340_2() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E1 {\n");
    buf.append("    int[] array = new int[3];\n");
    buf.append("    static boolean same(E1 one, E1 two) {\n");
    buf.append("        for (int i = 0; i < one.array.length; i++) {\n");
    buf.append("            if (one.array[i] != two.array[i])\n");
    buf.append("                return false;\n");
    buf.append("        }\n");
    buf.append("        return true;\n");
    buf.append("    }\n");
    buf.append("}\n");
    buf.append("\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E1.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

26. ConvertForLoopQuickFixTest#testBug214340_1()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBug214340_1() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E1 {\n");
    buf.append("    int[] array = new int[3];\n");
    buf.append("\n");
    buf.append("    boolean same(E1 that) {\n");
    buf.append("        for (int i = 0; i < array.length; i++) {\n");
    buf.append("            if (this.array[i] != that.array[i])\n");
    buf.append("                return false;\n");
    buf.append("        }\n");
    buf.append("        return true;\n");
    buf.append("    }\n");
    buf.append("\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E1.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

27. ConvertForLoopQuickFixTest#testBodyPrecondition344674_9()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition344674_9() throws Exception {
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=344674
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    String[] tokens;\n");
    buf.append("    E other;\n");
    buf.append("    private E get(E a) {\n");
    buf.append("        return a;\n");
    buf.append("    }\n");
    buf.append("    public void foo(E arg) {\n");
    buf.append("        for (int i = 0; i < get(other).tokens.length; i++) {\n");
    buf.append("            E other = this; // local var shadows field\n");
    buf.append("            System.out.println(get(other).tokens[i]);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

28. ConvertForLoopQuickFixTest#testBodyPrecondition344674_8()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition344674_8() throws Exception {
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=344674
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E implements Comparable<E> {\n");
    buf.append("    private int[] tokens;\n");
    buf.append("    public int compareTo(E obj) {\n");
    buf.append("        for (int i = 0; i < obj.tokens.length; i++) {\n");
    buf.append("            int v = compare(obj.tokens[i], this.tokens[i]);\n");
    buf.append("            if (v != 0)\n");
    buf.append("                return v;\n");
    buf.append("        }\n");
    buf.append("        return 0;\n");
    buf.append("    }\n");
    buf.append("    private int compare(int i, int j) {\n");
    buf.append("        return i < j ? -1 : i == j ? 0 : 1;\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

29. ConvertForLoopQuickFixTest#testBodyPrecondition344674_7()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition344674_7() throws Exception {
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=344674
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E implements Comparable<Object> {\n");
    buf.append("    private int[] tokens;\n");
    buf.append("    public int compareTo(Object obj) {\n");
    buf.append("        for (int i = 0; i < ((E) obj).tokens.length; i++) {\n");
    buf.append("            int v = compare(((E) obj).tokens[i], this.tokens[i]);\n");
    buf.append("            if (v != 0)\n");
    buf.append("                return v;\n");
    buf.append("        }\n");
    buf.append("        return 0;\n");
    buf.append("    }\n");
    buf.append("    private int compare(int i, int j) {\n");
    buf.append("        return i < j ? -1 : i == j ? 0 : 1;\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

30. ConvertForLoopQuickFixTest#testBodyPrecondition344674_6()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition344674_6() throws Exception {
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=344674
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E implements Comparable<Object> {\n");
    buf.append("    private int[] tokens;\n");
    buf.append("    public int compareTo(Object obj) {\n");
    buf.append("        for (int i = 0; i < ((E) obj).tokens.length; i++) {\n");
    buf.append("            int v = compare(((E) obj).tokens[i], tokens[i]);\n");
    buf.append("            if (v != 0)\n");
    buf.append("                return v;\n");
    buf.append("        }\n");
    buf.append("        return 0;\n");
    buf.append("    }\n");
    buf.append("    private int compare(int i, int j) {\n");
    buf.append("        return i < j ? -1 : i == j ? 0 : 1;\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

31. ConvertForLoopQuickFixTest#testBodyPrecondition344674_5()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition344674_5() throws Exception {
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=344674
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E implements Comparable<Object> {\n");
    buf.append("    private int[] tokens;\n");
    buf.append("    public int compareTo(Object obj) {\n");
    buf.append("        for (int i = 0; i < this.tokens.length; i++) {\n");
    buf.append("            int v = compare(tokens[i], ((E) obj).tokens[i]);\n");
    buf.append("            if (v != 0)\n");
    buf.append("                return v;\n");
    buf.append("        }\n");
    buf.append("        return 0;\n");
    buf.append("    }\n");
    buf.append("    private int compare(int i, int j) {\n");
    buf.append("        return i < j ? -1 : i == j ? 0 : 1;\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

32. ConvertForLoopQuickFixTest#testBodyPrecondition344674_4()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition344674_4() throws Exception {
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=344674
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E implements Comparable<Object> {\n");
    buf.append("    private int[] tokens;\n");
    buf.append("    public int compareTo(Object obj) {\n");
    buf.append("        for (int i = 0; i < tokens.length; i++) {\n");
    buf.append("            int v = compare(tokens[i], ((E) obj).tokens[i]);\n");
    buf.append("            if (v != 0)\n");
    buf.append("                return v;\n");
    buf.append("        }\n");
    buf.append("        return 0;\n");
    buf.append("    }\n");
    buf.append("    private int compare(int i, int j) {\n");
    buf.append("        return i < j ? -1 : i == j ? 0 : 1;\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

33. ConvertForLoopQuickFixTest#testBodyPrecondition344674_3()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition344674_3() throws Exception {
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=344674
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    Object[] x;\n");
    buf.append("    public void foo(Object obj) {\n");
    buf.append("        for (int i = 0; i < ((E) obj).x.length; i++) {\n");
    buf.append("            System.out.println(((E) obj).x[i]);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

34. ConvertForLoopQuickFixTest#testBodyPrecondition344674_2()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition344674_2() throws Exception {
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=344674
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    Object[] x;\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int i = 0; i < this.x.length; i++) {\n");
    buf.append("            System.out.println(this.x[i]);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

35. ConvertForLoopQuickFixTest#testBodyPrecondition344674_1()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition344674_1() throws Exception {
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=344674
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    Object[] x;\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int i = 0; i < this.x.length; i++) {\n");
    buf.append("            System.out.println(x[i]);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

36. ConvertForLoopQuickFixTest#testBodyPrecondition13()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition13() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("import java.util.Iterator;\n");
    buf.append("import java.util.List;\n");
    buf.append("public class E {\n");
    buf.append("    void foo(List<String> data) {\n");
    buf.append("        for (Iterator<String> iterator = data.iterator(); iterator.hasNext();) {\n");
    buf.append("            String row = iterator.next();\n");
    buf.append("            row.equals(iterator.hasNext());\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    buf.append("\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

37. ConvertForLoopQuickFixTest#testBodyPrecondition12()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition12() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0, length= x.length; length > i; i++) {\n");
    buf.append("            System.out.println(length);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

38. ConvertForLoopQuickFixTest#testBodyPrecondition11()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition11() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(int[] x) {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {\n");
    buf.append("            x[i]++;\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

39. ConvertForLoopQuickFixTest#testBodyPreconditio10()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPreconditio10() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(int[] x) {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {\n");
    buf.append("            --x[i];\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

40. ConvertForLoopQuickFixTest#testBodyPrecondition09()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition09() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {\n");
    buf.append("            x[i]= null;\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

41. ConvertForLoopQuickFixTest#testBodyPrecondition08()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition08() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    Object[] x;\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {\n");
    buf.append("            x= null;\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

42. ConvertForLoopQuickFixTest#testBodyPrecondition07()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition07() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {\n");
    buf.append("            x= null;\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

43. ConvertForLoopQuickFixTest#testBodyPrecondition06()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition06() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    Object[] x;\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {\n");
    buf.append("            this.x= null;\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

44. ConvertForLoopQuickFixTest#testBodyPrecondition05()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition05() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    Object[] x;\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {\n");
    buf.append("			System.out.println(i);");
    buf.append("            System.out.println(this.x[i]);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

45. ConvertForLoopQuickFixTest#testBodyPrecondition04()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition04() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    Object[] x;\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {\n");
    buf.append("			i++;");
    buf.append("            System.out.println(this.x[i]);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

46. ConvertForLoopQuickFixTest#testBodyPrecondition03()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition03() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    Object[] x;\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {\n");
    buf.append("            System.out.println(this.x[i]);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

47. ConvertForLoopQuickFixTest#testBodyPrecondition02()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition02() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    Object[] x;\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {\n");
    buf.append("            System.out.println(x[i]);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

48. ConvertForLoopQuickFixTest#testBodyPrecondition01()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBodyPrecondition01() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {\n");
    buf.append("            System.out.println(x[i]);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

49. ConvertForLoopQuickFixTest#testUpdatePrecondition07()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testUpdatePrecondition07() throws Exception {
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=349782
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; i < x.length; ++i) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

50. ConvertForLoopQuickFixTest#testUpdatePrecondition06()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testUpdatePrecondition06() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("		int j= 0");
    buf.append("        for (int i = 0; i < x.length; i= j + 1) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

51. ConvertForLoopQuickFixTest#testUpdatePrecondition04()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testUpdatePrecondition04() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; i < x.length; i= i + 2) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

52. ConvertForLoopQuickFixTest#testUpdatePrecondition03()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testUpdatePrecondition03() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; i < x.length; i= i + 1) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

53. ConvertForLoopQuickFixTest#testUpdatePrecondition02()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testUpdatePrecondition02() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; i < x.length; i= 1 + i) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

54. ConvertForLoopQuickFixTest#testUpdatePrecondition01()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testUpdatePrecondition01() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; i < x.length; i+= 1) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

55. ConvertForLoopQuickFixTest#testExpressionPrecondition08()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testExpressionPrecondition08() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0, length= x.length; length > i; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

56. ConvertForLoopQuickFixTest#testExpressionPrecondition07()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testExpressionPrecondition07() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0, length= x.length; i < length; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

57. ConvertForLoopQuickFixTest#testExpressionPrecondition06()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testExpressionPrecondition06() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    Object[] x;\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int i = 0; i < this.x.length; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

58. ConvertForLoopQuickFixTest#testExpressionPrecondition05()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testExpressionPrecondition05() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    Object[] x;\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

59. ConvertForLoopQuickFixTest#testExpressionPrecondition04()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testExpressionPrecondition04() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    private static class MyClass {\n");
    buf.append("        public int length;\n");
    buf.append("    }\n");
    buf.append("    public void foo(MyClass x) {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

60. ConvertForLoopQuickFixTest#testExpressionPrecondition03()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testExpressionPrecondition03() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; x.length < j; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

61. ConvertForLoopQuickFixTest#testExpressionPrecondition02()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testExpressionPrecondition02() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; x.length <= i; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

62. ConvertForLoopQuickFixTest#testExpressionPrecondition01()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testExpressionPrecondition01() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; x.length > i; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

63. ConvertForLoopQuickFixTest#testInitializerPrecondition06()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testInitializerPrecondition06() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E1 {\n");
    buf.append("    void foo(Object[] x) {\n");
    buf.append("        for (int j = 0, a = init(); j < x.length; j++) {\n");
    buf.append("            System.out.println(x[j]);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("    private int init() {return 0;}\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

64. ConvertForLoopQuickFixTest#testInitializerPrecondition05()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testInitializerPrecondition05() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0, length= x.length; i < x.length; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

65. ConvertForLoopQuickFixTest#testInitializerPrecondition04()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testInitializerPrecondition04() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        int i, f;\n");
    buf.append("        for (i = 0, f= 0; i < x.length; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

66. ConvertForLoopQuickFixTest#testInitializerPrecondition03()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testInitializerPrecondition03() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        int i;");
    buf.append("        for (i = 0; i < x.length; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

67. ConvertForLoopQuickFixTest#testInitializerPrecondition02()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testInitializerPrecondition02() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 1; i < x.length; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertFalse(satisfiesPrecondition(cu));
}

68. ConvertForLoopQuickFixTest#testInitializerPrecondition01()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testInitializerPrecondition01() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object[] x) {\n");
    buf.append("        for (int i = 0; i < x.length; i++) {}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    assertTrue(satisfiesPrecondition(cu));
}

69. ConvertForLoopQuickFixTest#testBug149797()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBug149797() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    private int ba r() {return 0;}\n");
    buf.append("    public void foo(int[] ints) {\n");
    buf.append("        for (int i = 0, max = ints.length, b= bar(); i < max; i++) {\n");
    buf.append("            System.out.println(ints[i] + b);\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

70. ConvertForLoopQuickFixTest#testBug148419()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBug148419() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    private int[] ints;\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int i = 0; i < this.ints.length; i++) {\n");
    buf.append("            this.ints[i]= 0;\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

71. ConvertForLoopQuickFixTest#testBug130139_2()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBug130139_2() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(String[] strings) {\n");
    buf.append("        for (int i= x(); i < strings.length; i++) {\n");
    buf.append("            System.out.println(strings[i]);\n");
    buf.append("        }  \n");
    buf.append("    }\n");
    buf.append("    private int x(){\n");
    buf.append("        return 0;\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

72. ConvertForLoopQuickFixTest#testBug130139_1()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBug130139_1() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(String[] strings) {\n");
    buf.append("        int x= 1;\n");
    buf.append("        for (int i= x; i < strings.length; i++) {\n");
    buf.append("            System.out.println(strings[i]);\n");
    buf.append("        }  \n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

73. ConvertForLoopQuickFixTest#testBug127346()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testBug127346() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test;\n");
    buf.append("public class E1 {\n");
    buf.append("    public void foo() {\n");
    buf.append("        for (int[] arr= new int[7]; 1 < arr.length;) {\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E1.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

74. ConvertForLoopQuickFixTest#testIndexDoesNotStartFromZero()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testIndexDoesNotStartFromZero() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array= null;\n");
    buf.append("		for (int i= 1; i < array.length; i++);\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

75. ConvertForLoopQuickFixTest#testCollectionsNotAcceptedYet()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testCollectionsNotAcceptedYet() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import java.util.List;\n");
    buf.append("import java.util.ArrayList;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		List strings= new ArrayList();\n");
    buf.append("		for (int i= 0; i < strings.size(); i++);\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

76. ConvertForLoopQuickFixTest#testCollectionBindingIsNull()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testCollectionBindingIsNull() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		for (int i = 0; i < arra.length; i++){\n");
    buf.append("			System.out.println(array[i]);\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

77. ConvertForLoopQuickFixTest#testCollectionTypeBindingIsNull()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testCollectionTypeBindingIsNull() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		in[] array = {1,2,3,4};\n");
    buf.append("		for (int i = 0; i < array.length; i++){\n");
    buf.append("			System.out.println(array[i]);\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

78. ConvertForLoopQuickFixTest#testAdditionalLocalIsNotReferenced2()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testAdditionalLocalIsNotReferenced2() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		int i,j;\n");
    buf.append("		for (i = 0, j = 1; i < array.length; i++){\n");
    buf.append("			System.out.println(array[i] + j++);\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

79. ConvertForLoopQuickFixTest#testTwoIndexesNotAllowed()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testTwoIndexesNotAllowed() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		for (int i = 0, j = 0; i < array.length; i++, j++){\n");
    buf.append("			System.out.println(array[i] + j);\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

80. ConvertForLoopQuickFixTest#testAdditionalLocalIsNotReferenced()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testAdditionalLocalIsNotReferenced() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		for (int i = 0, j = 0; i < array.length; i++){\n");
    buf.append("			System.out.println(array[i] + j++);\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

81. ConvertForLoopQuickFixTest#testCollectionIsNotArray()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testCollectionIsNotArray() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		java.util.List list = new ArrayList();\n");
    buf.append("		list.add(null);\n");
    buf.append("		for (int i = 0; i < list.size(); i++){\n");
    buf.append("			System.out.println(list.get(i);\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

82. ConvertForLoopQuickFixTest#testReverseTraversalIsNotAllowed()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testReverseTraversalIsNotAllowed() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		for (int i = array.length; i > 0; --i){\n");
    buf.append("			System.out.println(array[i]);\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

83. ConvertForLoopQuickFixTest#testIndexReadOutsideInferredArrayAccess2()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testIndexReadOutsideInferredArrayAccess2() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public int get(int i) {\n");
    buf.append("        return i; \n");
    buf.append("    }\n");
    buf.append("    public void foo() {\n");
    buf.append("		String[] array = null;\n");
    buf.append("		for (int i = 0; i < array.length; i++){\n");
    buf.append("			System.out.println(array[get(i)]);\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

84. ConvertForLoopQuickFixTest#testIndexReadOutsideInferredArrayAccess()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testIndexReadOutsideInferredArrayAccess() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		int[] array2 = {1,2,3,4};\n");
    buf.append("		for (int i = 0; i < array.length; i++){\n");
    buf.append("			System.out.println(array[i] + array2[i]);\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

85. ConvertForLoopQuickFixTest#testIndexReadOutsideArrayAccess_StringConcatenation()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testIndexReadOutsideArrayAccess_StringConcatenation() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		for (int i = 0; i < array.length; i++){\n");
    buf.append("			System.out.println(i + array[i]);");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

86. ConvertForLoopQuickFixTest#testIndexReadOutsideArrayAccess()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testIndexReadOutsideArrayAccess() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		for (int i = 0; i < array.length; i++){\n");
    buf.append("			if (i == 1){};\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

87. ConvertForLoopQuickFixTest#testIndexBruteModified2()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testIndexBruteModified2() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		for (int i = 0; i < array.length; i++){\n");
    buf.append("			i = array.lenght;\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

88. ConvertForLoopQuickFixTest#testIndexBruteModified()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testIndexBruteModified() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		for (int i = 0; i < array.length; i++){\n");
    buf.append("			System.out.println(array[i]);\n");
    buf.append("			i++;\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

89. ConvertForLoopQuickFixTest#testArrayCannotBeInferred()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testArrayCannotBeInferred() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		for (int i = 0; i < 4; i++){\n");
    buf.append("			System.out.println(array[i]);\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

90. ConvertForLoopQuickFixTest#testArrayIsAssigned2()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testArrayIsAssigned2() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		for (int i = 0; i < array.length; i++){\n");
    buf.append("			++array[i];\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

91. ConvertForLoopQuickFixTest#testArrayIsAssigned()

Project: che
File: ConvertForLoopQuickFixTest.java
@Test
public void testArrayIsAssigned() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class A {\n");
    buf.append("    public void foo() {\n");
    buf.append("		int[] array = {1,2,3,4};\n");
    buf.append("		for (int i = 0; i < array.length; i++){\n");
    buf.append("			array[i]=0;\n");
    buf.append("		}\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("A.java", buf.toString(), false, null);
    List proposals = fetchConvertingProposal(buf, cu);
    assertNull(fConvertLoopProposal);
    assertCorrectLabels(proposals);
}

92. AdvancedQuickAssistTest#testCombineStringsProposals5()

Project: che
File: AdvancedQuickAssistTest.java
@Test
public void testCombineStringsProposals5() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo() {\n");
    buf.append("        String string = \"Hello\" + \"World\" + 2;\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    int offset = buf.toString().indexOf("\"Hello\" + \"World\"");
    int length = "\"Hello\" + \"World\"".length();
    AssistContext context = getCorrectionContext(cu, offset, length);
    List proposals = collectAssists(context, false);
    assertProposalDoesNotExist(proposals, CorrectionMessages.AdvancedQuickAssistProcessor_combineSelectedStrings);
}

93. AdvancedQuickAssistTest#testCombineStringsProposals3()

Project: che
File: AdvancedQuickAssistTest.java
@Test
public void testCombineStringsProposals3() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo() {\n");
    buf.append("        String string = \"Hello World\";\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    int offset = buf.toString().indexOf("\"Hello World\"");
    AssistContext context = getCorrectionContext(cu, offset, 0);
    List proposals = collectAssists(context, false);
    assertProposalDoesNotExist(proposals, CorrectionMessages.AdvancedQuickAssistProcessor_combineSelectedStrings);
}

94. AdvancedQuickAssistTest#testPickOutStringProposals4()

Project: che
File: AdvancedQuickAssistTest.java
@Test
public void testPickOutStringProposals4() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo() {\n");
    buf.append("        String string = \"Hello World\";\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    int offset = buf.toString().indexOf("Hello");
    int length = "Hello World".length();
    AssistContext context = getCorrectionContext(cu, offset, length);
    List proposals = collectAssists(context, false);
    assertProposalDoesNotExist(proposals, "Pick out selected part of String");
}

95. AdvancedQuickAssistTest#testPickOutStringProposals3()

Project: che
File: AdvancedQuickAssistTest.java
@Test
public void testPickOutStringProposals3() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo() {\n");
    buf.append("        String string = \"Hello World\";\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    int offset = buf.toString().indexOf("World");
    AssistContext context = getCorrectionContext(cu, offset, 0);
    List proposals = collectAssists(context, false);
    assertProposalDoesNotExist(proposals, "Pick out selected part of String");
}

96. AdvancedQuickAssistTest#testConvertIfToSwitchBug393147_2()

Project: che
File: AdvancedQuickAssistTest.java
@Test
public void testConvertIfToSwitchBug393147_2() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo() {\n");
    buf.append("        if (this.equals(\"a\")) {\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    int offset = buf.toString().indexOf("if");
    AssistContext context = getCorrectionContext(cu, offset, 0);
    assertNoErrors(context);
    List proposals = collectAssists(context, false);
    assertNumberOfProposals(proposals, 1);
    assertCorrectLabels(proposals);
    assertProposalDoesNotExist(proposals, CorrectionMessages.AdvancedQuickAssistProcessor_convertIfElseToSwitch);
}

97. AdvancedQuickAssistTest#testConvertIfToSwitchBug393147()

Project: che
File: AdvancedQuickAssistTest.java
@Test
public void testConvertIfToSwitchBug393147() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo() {\n");
    buf.append("        if (equals(\"a\")) {\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    int offset = buf.toString().indexOf("if");
    AssistContext context = getCorrectionContext(cu, offset, 0);
    assertNoErrors(context);
    List proposals = collectAssists(context, false);
    assertNumberOfProposals(proposals, 1);
    assertCorrectLabels(proposals);
    assertProposalDoesNotExist(proposals, CorrectionMessages.AdvancedQuickAssistProcessor_convertIfElseToSwitch);
}

98. AdvancedQuickAssistTest#testPullNegationUpBug335778_2()

Project: che
File: AdvancedQuickAssistTest.java
@Test
public void testPullNegationUpBug335778_2() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object a) {\n");
    buf.append("        if (!(a instanceof String)) {\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    int offset = buf.toString().indexOf("!(");
    int length = "!(a instanceof String)".length();
    AssistContext context = getCorrectionContext(cu, offset, length);
    assertNoErrors(context);
    List proposals = collectAssists(context, false);
    assertCorrectLabels(proposals);
    assertProposalDoesNotExist(proposals, "Pull negation up");
}

99. AdvancedQuickAssistTest#testPullNegationUpBug335778_1()

Project: che
File: AdvancedQuickAssistTest.java
@Test
public void testPullNegationUpBug335778_1() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(boolean b) {\n");
    buf.append("        if (!b) {\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    int offset = buf.toString().indexOf("!b");
    int length = "!b".length();
    AssistContext context = getCorrectionContext(cu, offset, length);
    assertNoErrors(context);
    List proposals = collectAssists(context, false);
    assertCorrectLabels(proposals);
    assertProposalDoesNotExist(proposals, "Pull negation up");
}

100. AdvancedQuickAssistTest#testPushNegationDownBug335778_2()

Project: che
File: AdvancedQuickAssistTest.java
@Test
public void testPushNegationDownBug335778_2() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    public void foo(Object a) {\n");
    buf.append("        if (!(a instanceof String)) {\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    int offset = buf.toString().indexOf("!(");
    AssistContext context = getCorrectionContext(cu, offset, 0);
    assertNoErrors(context);
    List proposals = collectAssists(context, false);
    assertCorrectLabels(proposals);
    assertProposalDoesNotExist(proposals, "Push negation down");
}