Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 5812 Details for
Bug 41691
Move static members fails if "//" is before member [refactoring]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Test
41691_2_org.eclipse.jdt.ui.tests.refactoring_patch.txt (text/plain), 35.46 KB, created by
Markus Keller
on 2003-08-21 05:36:22 EDT
(
hide
)
Description:
Test
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2003-08-21 05:36:22 EDT
Size:
35.46 KB
patch
obsolete
>Index: resources/MoveMembers/test30/out/B.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.ui.tests.refactoring/resources/MoveMembers/test30/out/B.java,v >retrieving revision 1.1 >diff -u -r1.1 B.java >--- resources/MoveMembers/test30/out/B.java 19 Aug 2003 16:53:57 -0000 1.1 >+++ resources/MoveMembers/test30/out/B.java 21 Aug 2003 09:28:51 -0000 >@@ -2,5 +2,4 @@ > public class B { > > public final static String id= "Thing.id"; //$NON-NLS-1$ >- > } >Index: resources/MoveMembers/test31/out/B.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.ui.tests.refactoring/resources/MoveMembers/test31/out/B.java,v >retrieving revision 1.1 >diff -u -r1.1 B.java >--- resources/MoveMembers/test31/out/B.java 19 Aug 2003 16:53:57 -0000 1.1 >+++ resources/MoveMembers/test31/out/B.java 21 Aug 2003 09:28:51 -0000 >@@ -2,5 +2,4 @@ > public class B { > > public final static String odd= "Thing.odd"; //$NON-NLS-1$ >- > } >Index: test cases/org/eclipse/jdt/ui/tests/refactoring/MoveMembersTests.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveMembersTests.java,v >retrieving revision 1.16 >diff -u -r1.16 MoveMembersTests.java >--- test cases/org/eclipse/jdt/ui/tests/refactoring/MoveMembersTests.java 19 Aug 2003 16:53:27 -0000 1.16 >+++ test cases/org/eclipse/jdt/ui/tests/refactoring/MoveMembersTests.java 21 Aug 2003 09:29:21 -0000 >@@ -1,450 +1,455 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2003 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Common Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/cpl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.jdt.ui.tests.refactoring; >- >-import junit.framework.Test; >-import junit.framework.TestSuite; >- >-import org.eclipse.jdt.core.ICompilationUnit; >-import org.eclipse.jdt.core.IField; >-import org.eclipse.jdt.core.IMember; >-import org.eclipse.jdt.core.IMethod; >-import org.eclipse.jdt.core.IPackageFragment; >-import org.eclipse.jdt.core.IType; >-import org.eclipse.jdt.core.JavaModelException; >- >-import org.eclipse.jdt.ui.tests.refactoring.infra.DebugUtils; >- >-import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; >- >-import org.eclipse.jdt.internal.corext.refactoring.base.RefactoringStatus; >-import org.eclipse.jdt.internal.corext.refactoring.structure.MoveStaticMembersRefactoring; >- >-public class MoveMembersTests extends RefactoringTest { >- >- private static final Class clazz= MoveMembersTests.class; >- >- private static final String REFACTORING_PATH= "MoveMembers/"; >- >- public MoveMembersTests(String name) { >- super(name); >- } >- >- public static Test suite() { >- return new MySetup(new TestSuite(clazz)); >- } >- >- protected String getRefactoringPath() { >- return REFACTORING_PATH; >- } >- >- //--- >- private static MoveStaticMembersRefactoring createRefactoring(IMember[] members) throws JavaModelException{ >- return MoveStaticMembersRefactoring.create(members, JavaPreferencesSettings.getCodeGenerationSettings()); >- } >- >- protected void setUp() throws Exception { >- if (fIsVerbose) >- DebugUtils.dump("--------- " + getName() + " ---------------"); >- super.setUp(); >- } >- >- private void fieldMethodHelper_passingTest(String[] fieldNames, String[] methodNames, String[][] signatures, IPackageFragment packForA, IPackageFragment packForB) throws Exception { >- ICompilationUnit cuA= createCUfromTestFile(packForA, "A"); >- ICompilationUnit cuB= createCUfromTestFile(packForB, "B"); >- try{ >- IType typeA= getType(cuA, "A"); >- IType typeB= getType(cuB, "B"); >- IField[] fields= getFields(typeA, fieldNames); >- IMethod[] methods= getMethods(typeA, methodNames, signatures); >- >- MoveStaticMembersRefactoring ref= createRefactoring(merge(methods, fields)); >- IType destinationType= typeB; >- ref.setDestinationTypeFullyQualifiedName(destinationType.getFullyQualifiedName()); >- >- RefactoringStatus result= performRefactoringWithStatus(ref); >- assertTrue("precondition was supposed to pass", result.getSeverity() <= RefactoringStatus.WARNING); >- >- String expected; >- String actual; >- >- expected= getFileContents(getOutputTestFileName("A")); >- actual= cuA.getSource(); >- assertEquals("incorrect modification of A", expected, actual); >- >- expected= getFileContents(getOutputTestFileName("B")); >- actual= cuB.getSource(); >- assertEquals("incorrect modification of B", expected, actual); >- >- } finally{ >- performDummySearch(); >- cuA.delete(false, null); >- cuB.delete(false, null); >- } >- } >- >- private void fieldMethodHelper_passingTest(String[] fieldNames, String[] methodNames, String[][] signatures) throws Exception{ >- IPackageFragment packForA= getPackageP(); >- IPackageFragment packForB= getPackageP(); >- fieldMethodHelper_passingTest(fieldNames, methodNames, signatures, packForA, packForB); >- } >- >- private void fieldMethodHelper_failingTest(String[] fieldNames, >- String[] methodNames, String[][] signatures, >- int errorLevel, String destinationTypeName, >- IPackageFragment packForA, >- IPackageFragment packForB) throws Exception { >- ICompilationUnit cuA= createCUfromTestFile(packForA, "A"); >- ICompilationUnit cuB= createCUfromTestFile(packForB, "B"); >- try{ >- IType typeA= getType(cuA, "A"); >- IField[] fields= getFields(typeA, fieldNames); >- IMethod[] methods= getMethods(typeA, methodNames, signatures); >- >- MoveStaticMembersRefactoring ref= createRefactoring(merge(methods, fields)); >- if (ref == null){ >- assertEquals(errorLevel, RefactoringStatus.FATAL); >- return; >- } >- ref.setDestinationTypeFullyQualifiedName(destinationTypeName); >- >- RefactoringStatus result= performRefactoring(ref); >- if (fIsVerbose) >- DebugUtils.dump("status:" + result); >- assertNotNull("precondition was supposed to fail", result); >- assertEquals("precondition was supposed to fail", errorLevel, result.getSeverity()); >- >- } finally{ >- performDummySearch(); >- cuA.delete(false, null); >- cuB.delete(false, null); >- } >- } >- >- private void fieldMethodHelper_failingTest(String[] fieldNames, >- String[] methodNames, String[][] signatures, >- int errorLevel, String destinationTypeName) throws Exception { >- IPackageFragment packForA= getPackageP(); >- IPackageFragment packForB= getPackageP(); >- fieldMethodHelper_failingTest(fieldNames, methodNames, signatures, errorLevel, destinationTypeName, packForA, packForB); >- } >- //--- >- public void test0() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test1() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test2() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test3() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test4() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test5() throws Exception{ >- fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); >- } >- >- public void test6() throws Exception{ >- fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); >- } >- >- public void test7() throws Exception{ >- fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); >- } >- >- public void test8() throws Exception{ >-// printTestDisabledMessage("36835"); >- IPackageFragment packageForB= null; >- try{ >- packageForB= getRoot().createPackageFragment("r", false, null); >- fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0], getPackageP(), packageForB); >- } finally{ >- performDummySearch(); >- if (packageForB != null) >- packageForB.delete(true, null); >- } >- } >- >- public void test9() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test10() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test11() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test12() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test13() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test14() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test15() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test16() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test17() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test18() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test19() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test20() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test21() throws Exception{ >- printTestDisabledMessage("incorrect warning"); >-// fieldMethodHelper_passingTest(new String[]{"F", "i"}, new String[0], new String[0][0]); >- } >- >- public void test22() throws Exception{ >- printTestDisabledMessage("nasty corner case"); >-// fieldMethodHelper_passingTest(new String[]{"i"}, new String[0], new String[0][0]); >- } >- >- public void test23() throws Exception{ >- fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); >- } >- >- public void test24() throws Exception{ >- fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); >- } >- >- public void test25() throws Exception{ >- //printTestDisabledMessage("test for 27098"); >- fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); >- } >- >- public void test26() throws Exception{ >- IPackageFragment packageForB= null; >- try{ >- packageForB= getRoot().createPackageFragment("r", false, null); >- fieldMethodHelper_passingTest(new String[0], new String[]{"n"}, new String[][]{new String[0]}, getPackageP(), packageForB); >- } finally{ >- performDummySearch(); >- if (packageForB != null) >- packageForB.delete(true, null); >- } >- } >- >- public void test27() throws Exception{ >- IPackageFragment packageForB= null; >- try{ >- packageForB= getRoot().createPackageFragment("r", false, null); >- fieldMethodHelper_passingTest(new String[0], new String[]{"n"}, new String[][]{new String[0]}, getPackageP(), packageForB); >- } finally{ >- performDummySearch(); >- if (packageForB != null) >- packageForB.delete(true, null); >- } >- } >- >- public void test28() throws Exception{ >- fieldMethodHelper_passingTest(new String[0], new String[]{"m", "n"}, new String[][]{new String[0], new String[0]}); >- } >- >- public void test29() throws Exception{ //test for bug 41691 >- fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >- } >- >- public void test30() throws Exception{ //test for bug 41691 >- fieldMethodHelper_passingTest(new String[]{"id"}, new String[0], new String[0][0]); >- } >- >- public void test31() throws Exception{ //test for bug 41691 >- fieldMethodHelper_passingTest(new String[]{"odd"}, new String[0], new String[0][0]); >- } >- >- //--- >- public void testFail0() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.FATAL, "p.B"); >- } >- >- >- public void testFail1() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.ERROR, "p.B.X"); >- } >- >- public void testFail2() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.ERROR, "p.B"); >- } >- >- public void testFail3() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, >- RefactoringStatus.ERROR, "p.B"); >- } >- >- public void testFail4() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, >- RefactoringStatus.WARNING, "p.B"); >- } >- >- public void testFail5() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, >- RefactoringStatus.WARNING, "p.B"); >- } >- >- public void testFail6() throws Exception{ >- fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >- RefactoringStatus.ERROR, "p.B"); >- } >- >- public void testFail7() throws Exception{ >- fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >- RefactoringStatus.ERROR, "p.B"); >- } >- >- public void testFail8() throws Exception{ >- fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >- RefactoringStatus.ERROR, "p.B"); >- } >- >- public void testFail9() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.WARNING, "p.B"); >- } >- >- public void testFail10() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.WARNING, "p.B"); >- } >- >- public void testFail11() throws Exception{ >- fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >- RefactoringStatus.WARNING, "p.B"); >- } >- >- public void testFail12() throws Exception{ >- fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >- RefactoringStatus.WARNING, "p.B"); >- } >- >- public void testFail13() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.WARNING, "p.B"); >- } >- >- public void testFail14() throws Exception{ >- fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >- RefactoringStatus.WARNING, "p.B"); >- } >- >- public void testFail15() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.WARNING, "p.B"); >- } >- >- public void testFail16() throws Exception{ >- IPackageFragment packageForB= null; >- try{ >- packageForB= getRoot().createPackageFragment("r", false, null); >- fieldMethodHelper_failingTest(new String[]{"f"}, new String[0], new String[0][0], >- RefactoringStatus.WARNING, "r.B", >- getPackageP(), packageForB); >- } finally{ >- performDummySearch(); >- if (packageForB != null) >- packageForB.delete(true, null); >- } >- } >- >- public void testFail17() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.FATAL, "java.lang.Object"); >- } >- >- public void testFail18() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.FATAL, "p.DontExist"); >- } >- >- public void testFail19() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.FATAL, "p.B"); >- } >- >- public void testFail20() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.FATAL, "p.B"); >- } >- >- public void testFail21() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.FATAL, "p.B"); >- } >- >- public void testFail22() throws Exception{ >- fieldMethodHelper_failingTest(new String[]{"i"}, >- new String[0], new String[0][0], >- RefactoringStatus.FATAL, "p.B"); >- } >- >- public void testFail23() throws Exception{ >- fieldMethodHelper_failingTest(new String[]{"i"}, >- new String[0], new String[0][0], >- RefactoringStatus.FATAL, "p.B"); >- } >- >- public void testFail24() throws Exception{ >- fieldMethodHelper_failingTest(new String[0], >- new String[]{"m"}, new String[][]{new String[0]}, >- RefactoringStatus.FATAL, "p.B"); >- } >- >-} >+/******************************************************************************* >+ * Copyright (c) 2000, 2003 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.ui.tests.refactoring; >+ >+import junit.framework.Test; >+import junit.framework.TestSuite; >+ >+import org.eclipse.jdt.core.ICompilationUnit; >+import org.eclipse.jdt.core.IField; >+import org.eclipse.jdt.core.IMember; >+import org.eclipse.jdt.core.IMethod; >+import org.eclipse.jdt.core.IPackageFragment; >+import org.eclipse.jdt.core.IType; >+import org.eclipse.jdt.core.JavaModelException; >+ >+import org.eclipse.jdt.ui.tests.refactoring.infra.DebugUtils; >+ >+import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; >+ >+import org.eclipse.jdt.internal.corext.refactoring.base.RefactoringStatus; >+import org.eclipse.jdt.internal.corext.refactoring.structure.MoveStaticMembersRefactoring; >+ >+public class MoveMembersTests extends RefactoringTest { >+ >+ private static final Class clazz= MoveMembersTests.class; >+ >+ private static final String REFACTORING_PATH= "MoveMembers/"; >+ >+ public MoveMembersTests(String name) { >+ super(name); >+ } >+ >+ public static Test suite() { >+ return new MySetup(new TestSuite(clazz)); >+ } >+ >+ protected String getRefactoringPath() { >+ return REFACTORING_PATH; >+ } >+ >+ //--- >+ private static MoveStaticMembersRefactoring createRefactoring(IMember[] members) throws JavaModelException{ >+ return MoveStaticMembersRefactoring.create(members, JavaPreferencesSettings.getCodeGenerationSettings()); >+ } >+ >+ protected void setUp() throws Exception { >+ if (fIsVerbose) >+ DebugUtils.dump("--------- " + getName() + " ---------------"); >+ super.setUp(); >+ } >+ >+ private void fieldMethodHelper_passingTest(String[] fieldNames, String[] methodNames, String[][] signatures, IPackageFragment packForA, IPackageFragment packForB) throws Exception { >+ ICompilationUnit cuA= createCUfromTestFile(packForA, "A"); >+ ICompilationUnit cuB= createCUfromTestFile(packForB, "B"); >+ try{ >+ IType typeA= getType(cuA, "A"); >+ IType typeB= getType(cuB, "B"); >+ IField[] fields= getFields(typeA, fieldNames); >+ IMethod[] methods= getMethods(typeA, methodNames, signatures); >+ >+ MoveStaticMembersRefactoring ref= createRefactoring(merge(methods, fields)); >+ IType destinationType= typeB; >+ ref.setDestinationTypeFullyQualifiedName(destinationType.getFullyQualifiedName()); >+ >+ RefactoringStatus result= performRefactoringWithStatus(ref); >+ assertTrue("precondition was supposed to pass", result.getSeverity() <= RefactoringStatus.WARNING); >+ >+ String expected; >+ String actual; >+ >+ expected= getFileContents(getOutputTestFileName("A")); >+ actual= cuA.getSource(); >+ assertEquals("incorrect modification of A", expected, actual); >+ >+ expected= getFileContents(getOutputTestFileName("B")); >+ actual= cuB.getSource(); >+ assertEquals("incorrect modification of B", expected, actual); >+ >+ } finally{ >+ performDummySearch(); >+ cuA.delete(false, null); >+ cuB.delete(false, null); >+ } >+ } >+ >+ private void fieldMethodHelper_passingTest(String[] fieldNames, String[] methodNames, String[][] signatures) throws Exception{ >+ IPackageFragment packForA= getPackageP(); >+ IPackageFragment packForB= getPackageP(); >+ fieldMethodHelper_passingTest(fieldNames, methodNames, signatures, packForA, packForB); >+ } >+ >+ private void fieldMethodHelper_failingTest(String[] fieldNames, >+ String[] methodNames, String[][] signatures, >+ int errorLevel, String destinationTypeName, >+ IPackageFragment packForA, >+ IPackageFragment packForB) throws Exception { >+ ICompilationUnit cuA= createCUfromTestFile(packForA, "A"); >+ ICompilationUnit cuB= createCUfromTestFile(packForB, "B"); >+ try{ >+ IType typeA= getType(cuA, "A"); >+ IField[] fields= getFields(typeA, fieldNames); >+ IMethod[] methods= getMethods(typeA, methodNames, signatures); >+ >+ MoveStaticMembersRefactoring ref= createRefactoring(merge(methods, fields)); >+ if (ref == null){ >+ assertEquals(errorLevel, RefactoringStatus.FATAL); >+ return; >+ } >+ ref.setDestinationTypeFullyQualifiedName(destinationTypeName); >+ >+ RefactoringStatus result= performRefactoring(ref); >+ if (fIsVerbose) >+ DebugUtils.dump("status:" + result); >+ assertNotNull("precondition was supposed to fail", result); >+ assertEquals("precondition was supposed to fail", errorLevel, result.getSeverity()); >+ >+ } finally{ >+ performDummySearch(); >+ cuA.delete(false, null); >+ cuB.delete(false, null); >+ } >+ } >+ >+ private void fieldMethodHelper_failingTest(String[] fieldNames, >+ String[] methodNames, String[][] signatures, >+ int errorLevel, String destinationTypeName) throws Exception { >+ IPackageFragment packForA= getPackageP(); >+ IPackageFragment packForB= getPackageP(); >+ fieldMethodHelper_failingTest(fieldNames, methodNames, signatures, errorLevel, destinationTypeName, packForA, packForB); >+ } >+ //--- >+ public void test0() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test1() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test2() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test3() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test4() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test5() throws Exception{ >+ fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); >+ } >+ >+ public void test6() throws Exception{ >+ fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); >+ } >+ >+ public void test7() throws Exception{ >+ fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0]); >+ } >+ >+ public void test8() throws Exception{ >+// printTestDisabledMessage("36835"); >+ IPackageFragment packageForB= null; >+ try{ >+ packageForB= getRoot().createPackageFragment("r", false, null); >+ fieldMethodHelper_passingTest(new String[]{"f"}, new String[0], new String[0][0], getPackageP(), packageForB); >+ } finally{ >+ performDummySearch(); >+ if (packageForB != null) >+ packageForB.delete(true, null); >+ } >+ } >+ >+ public void test9() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test10() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test11() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test12() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test13() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test14() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test15() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test16() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test17() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test18() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test19() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test20() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test21() throws Exception{ >+ printTestDisabledMessage("incorrect warning"); >+// fieldMethodHelper_passingTest(new String[]{"F", "i"}, new String[0], new String[0][0]); >+ } >+ >+ public void test22() throws Exception{ >+ printTestDisabledMessage("nasty corner case"); >+// fieldMethodHelper_passingTest(new String[]{"i"}, new String[0], new String[0][0]); >+ } >+ >+ public void test23() throws Exception{ >+ fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); >+ } >+ >+ public void test24() throws Exception{ >+ fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); >+ } >+ >+ public void test25() throws Exception{ >+ //printTestDisabledMessage("test for 27098"); >+ fieldMethodHelper_passingTest(new String[]{"FRED"}, new String[0], new String[0][0]); >+ } >+ >+ public void test26() throws Exception{ >+ IPackageFragment packageForB= null; >+ try{ >+ packageForB= getRoot().createPackageFragment("r", false, null); >+ fieldMethodHelper_passingTest(new String[0], new String[]{"n"}, new String[][]{new String[0]}, getPackageP(), packageForB); >+ } finally{ >+ performDummySearch(); >+ if (packageForB != null) >+ packageForB.delete(true, null); >+ } >+ } >+ >+ public void test27() throws Exception{ >+ IPackageFragment packageForB= null; >+ try{ >+ packageForB= getRoot().createPackageFragment("r", false, null); >+ fieldMethodHelper_passingTest(new String[0], new String[]{"n"}, new String[][]{new String[0]}, getPackageP(), packageForB); >+ } finally{ >+ performDummySearch(); >+ if (packageForB != null) >+ packageForB.delete(true, null); >+ } >+ } >+ >+ public void test28() throws Exception{ >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m", "n"}, new String[][]{new String[0], new String[0]}); >+ } >+ >+ public void test29() throws Exception{ //test for bug 41691 >+ fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ public void test30() throws Exception{ //test for bug 41691 >+ fieldMethodHelper_passingTest(new String[]{"id"}, new String[0], new String[0][0]); >+ } >+ >+ public void test31() throws Exception{ //test for bug 41691 >+ fieldMethodHelper_passingTest(new String[]{"odd"}, new String[0], new String[0][0]); >+ } >+ >+ public void test32() throws Exception{ //test for bug 41734, 41691 >+ printTestDisabledMessage("test for 41734"); >+ //fieldMethodHelper_passingTest(new String[0], new String[]{"m"}, new String[][]{new String[0]}); >+ } >+ >+ //--- >+ public void testFail0() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.FATAL, "p.B"); >+ } >+ >+ >+ public void testFail1() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.ERROR, "p.B.X"); >+ } >+ >+ public void testFail2() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.ERROR, "p.B"); >+ } >+ >+ public void testFail3() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, >+ RefactoringStatus.ERROR, "p.B"); >+ } >+ >+ public void testFail4() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, >+ RefactoringStatus.WARNING, "p.B"); >+ } >+ >+ public void testFail5() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[]{"I", "I"}}, >+ RefactoringStatus.WARNING, "p.B"); >+ } >+ >+ public void testFail6() throws Exception{ >+ fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >+ RefactoringStatus.ERROR, "p.B"); >+ } >+ >+ public void testFail7() throws Exception{ >+ fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >+ RefactoringStatus.ERROR, "p.B"); >+ } >+ >+ public void testFail8() throws Exception{ >+ fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >+ RefactoringStatus.ERROR, "p.B"); >+ } >+ >+ public void testFail9() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.WARNING, "p.B"); >+ } >+ >+ public void testFail10() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.WARNING, "p.B"); >+ } >+ >+ public void testFail11() throws Exception{ >+ fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >+ RefactoringStatus.WARNING, "p.B"); >+ } >+ >+ public void testFail12() throws Exception{ >+ fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >+ RefactoringStatus.WARNING, "p.B"); >+ } >+ >+ public void testFail13() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.WARNING, "p.B"); >+ } >+ >+ public void testFail14() throws Exception{ >+ fieldMethodHelper_failingTest(new String[]{"i"}, new String[0], new String[0][0], >+ RefactoringStatus.WARNING, "p.B"); >+ } >+ >+ public void testFail15() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.WARNING, "p.B"); >+ } >+ >+ public void testFail16() throws Exception{ >+ IPackageFragment packageForB= null; >+ try{ >+ packageForB= getRoot().createPackageFragment("r", false, null); >+ fieldMethodHelper_failingTest(new String[]{"f"}, new String[0], new String[0][0], >+ RefactoringStatus.WARNING, "r.B", >+ getPackageP(), packageForB); >+ } finally{ >+ performDummySearch(); >+ if (packageForB != null) >+ packageForB.delete(true, null); >+ } >+ } >+ >+ public void testFail17() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.FATAL, "java.lang.Object"); >+ } >+ >+ public void testFail18() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.FATAL, "p.DontExist"); >+ } >+ >+ public void testFail19() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.FATAL, "p.B"); >+ } >+ >+ public void testFail20() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.FATAL, "p.B"); >+ } >+ >+ public void testFail21() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.FATAL, "p.B"); >+ } >+ >+ public void testFail22() throws Exception{ >+ fieldMethodHelper_failingTest(new String[]{"i"}, >+ new String[0], new String[0][0], >+ RefactoringStatus.FATAL, "p.B"); >+ } >+ >+ public void testFail23() throws Exception{ >+ fieldMethodHelper_failingTest(new String[]{"i"}, >+ new String[0], new String[0][0], >+ RefactoringStatus.FATAL, "p.B"); >+ } >+ >+ public void testFail24() throws Exception{ >+ fieldMethodHelper_failingTest(new String[0], >+ new String[]{"m"}, new String[][]{new String[0]}, >+ RefactoringStatus.FATAL, "p.B"); >+ } >+ >+} >Index: resources/MoveMembers/test32/in/A.java >=================================================================== >RCS file: resources/MoveMembers/test32/in/A.java >diff -N resources/MoveMembers/test32/in/A.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ resources/MoveMembers/test32/in/A.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+package p; >+public class A { >+ >+ static void abc() { >+ } >+ //Garbage code; >+ >+ //Is this comment retained somewhere? >+ >+ static void m() { >+ } >+} >Index: resources/MoveMembers/test32/in/B.java >=================================================================== >RCS file: resources/MoveMembers/test32/in/B.java >diff -N resources/MoveMembers/test32/in/B.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ resources/MoveMembers/test32/in/B.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+package p; >+public class B { >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 41691
:
5798
|
5811
| 5812