use of org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor in project che by eclipse.
the class RenameParametersTest method helper1.
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());
}
use of org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor in project che by eclipse.
the class RenameParametersTest method helper2.
private void helper2(String[] newNames, String[] signature) throws Exception {
IType classA = getType(createCUfromTestFile(getPackageP(), false, false), "A");
//DebugUtils.dump("classA" + classA);
IMethod method = classA.getMethod("m", signature);
Assert.assertTrue("refactoring not available", RefactoringAvailabilityTester.isChangeSignatureAvailable(method));
ChangeSignatureProcessor processor = new ChangeSignatureProcessor(method);
Refactoring ref = new ProcessorBasedRefactoring(processor);
modifyInfos(processor.getParameterInfos(), newNames);
RefactoringStatus result = performRefactoring(ref);
Assert.assertNotNull("precondition was supposed to fail", result);
}
Aggregations