Source:
private void checkRefactoring ( @ com.android.annotations.NonNull org.eclipse.core.resources.IProject project , @ com.android.annotations.NonNull java.lang.Object resource , boolean updateReferences , @ com.android.annotations.NonNull java.lang.String newName , @ com.android.annotations.NonNull java.lang.String expected ) throws java.lang.Exception { org.eclipse.ltk.core.refactoring.participants.RenameProcessor processor = null ; if ( resource instanceof java.lang.String ) { java.lang.String url = ( ( java.lang.String ) ( resource ) ) ; assert url.startsWith ( "@" ) : resource ; com.android.utils.Pair < com.android.resources.ResourceType , java.lang.String > pair = com.android.ide.eclipse.adt.internal.editors.Hyperlinks.parseResource ( url ) ; assertNotNull ( url , pair ) ; com.android.resources.ResourceType type = pair.getFirst ( ) ; java.lang.String currentName = pair.getSecond ( ) ; com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor p ; p = new com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor ( project , type , currentName , newName ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else if ( resource instanceof org.eclipse.core.resources.IResource ) { org.eclipse.core.resources.IResource r = ( ( org.eclipse.core.resources.IResource ) ( resource ) ) ; com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor p ; p = new com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor ( r ) ; java.lang.String fileName = r.getName ( ) ; int dot = fileName.indexOf ( '.' ) ; java.lang.String extension = ( dot != ( - 1 ) ) ? fileName.substring ( dot ) : "" ; p.setNewResourceName ( ( newName + extension ) ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else if ( resource instanceof org.eclipse.jdt.core.IField ) { org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor p = new org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor ( ( ( org.eclipse.jdt.core.IField ) ( resource ) ) ) ; p.setNewElementName ( newName ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else { fail ( ( "Unsupported resource element in tests: " + resource ) ) ; } assertNotNull ( processor ) ; org.eclipse.ltk.core.refactoring.participants.RenameRefactoring refactoring = new org.eclipse.ltk.core.refactoring.participants.RenameRefactoring ( processor ) ; org.eclipse.ltk.core.refactoring.RefactoringStatus status = refactoring.checkAllConditions ( new org.eclipse.core.runtime.NullProgressMonitor ( ) ) ; assertNotNull ( status ) ; if ( ! ( status.isOK ( ) ) ) { assertEquals ( status.toString ( ) , expected ) ; return ; } assertTrue ( status.toString ( ) , status.isOK ( ) ) ; org.eclipse.ltk.core.refactoring.Change change = refactoring.createChange ( new org.eclipse.core.runtime.NullProgressMonitor ( ) ) ; assertNotNull ( change ) ; java.lang.String explanation = "CHANGES:\n-------\n" + ( describe ( change ) ) ; if ( ! ( expected.trim ( ) . equals ( explanation.trim ( ) ) ) ) { assertEquals ( expected , explanation ) ; } }

Target:
protected void renameResource ( @ com.android.annotations.NonNull org.eclipse.core.resources.IProject project , @ com.android.annotations.NonNull java.lang.Object resource , boolean updateReferences , @ com.android.annotations.NonNull java.lang.String newName , @ com.android.annotations.NonNull java.lang.String expected ) throws java.lang.Exception { org.eclipse.ltk.core.refactoring.participants.RenameProcessor processor = null ; if ( resource instanceof java.lang.String ) { java.lang.String url = ( ( java.lang.String ) ( resource ) ) ; assert url.startsWith ( "@" ) : resource ; com.android.utils.Pair < com.android.resources.ResourceType , java.lang.String > pair = com.android.ide.eclipse.adt.internal.editors.Hyperlinks.parseResource ( url ) ; assertNotNull ( url , pair ) ; com.android.resources.ResourceType type = pair.getFirst ( ) ; java.lang.String currentName = pair.getSecond ( ) ; com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor p ; p = new com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor ( project , type , currentName , newName ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else if ( resource instanceof org.eclipse.core.resources.IResource ) { org.eclipse.core.resources.IResource r = ( ( org.eclipse.core.resources.IResource ) ( resource ) ) ; com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor p ; p = new com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor ( r ) ; java.lang.String fileName = r.getName ( ) ; int dot = fileName.indexOf ( '.' ) ; java.lang.String extension = ( dot != ( - 1 ) ) ? fileName.substring ( dot ) : "" ; p.setNewResourceName ( ( newName + extension ) ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else if ( resource instanceof org.eclipse.jdt.core.IField ) { org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor p = new org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor ( ( ( org.eclipse.jdt.core.IField ) ( resource ) ) ) ; p.setNewElementName ( newName ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else { fail ( ( "Unsupported resource element in tests: " + resource ) ) ; } assertNotNull ( processor ) ; org.eclipse.ltk.core.refactoring.participants.RenameRefactoring refactoring = new org.eclipse.ltk.core.refactoring.participants.RenameRefactoring ( processor ) ; checkRefactoring ( refactoring , expected ) ; }