Lines 10-15
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.core.tests.model; |
11 |
package org.eclipse.jdt.core.tests.model; |
12 |
|
12 |
|
|
|
13 |
import org.eclipse.core.resources.*; |
13 |
import org.eclipse.core.resources.IFile; |
14 |
import org.eclipse.core.resources.IFile; |
14 |
import org.eclipse.core.resources.IFolder; |
15 |
import org.eclipse.core.resources.IFolder; |
15 |
import org.eclipse.core.resources.IWorkspaceRunnable; |
16 |
import org.eclipse.core.resources.IWorkspaceRunnable; |
Lines 818-823
Link Here
|
818 |
assertEquals( |
819 |
assertEquals( |
819 |
"Unexpected matches found", |
820 |
"Unexpected matches found", |
820 |
"", |
821 |
"", |
|
|
822 |
resultCollector.toString()); |
823 |
} |
824 |
/* |
825 |
* Ensure search finds matches in an included package. |
826 |
* (case of setting the classpath) |
827 |
*/ |
828 |
public void testSearchWithIncludedPackage1() throws CoreException { |
829 |
createFolder("/P/src/p"); |
830 |
createFile( |
831 |
"/P/src/p/A.java", |
832 |
"package p;\n" + |
833 |
"public class A {\n" + |
834 |
"}" |
835 |
); |
836 |
setClasspath(new String[] {"/P/src", "p/"}); |
837 |
|
838 |
JavaSearchTests.JavaSearchResultCollector resultCollector = new JavaSearchTests.JavaSearchResultCollector(); |
839 |
search( |
840 |
"A", |
841 |
IJavaSearchConstants.TYPE, |
842 |
IJavaSearchConstants.DECLARATIONS, |
843 |
SearchEngine.createJavaSearchScope(new IJavaProject[] {getJavaProject("P")}), |
844 |
resultCollector); |
845 |
assertEquals( |
846 |
"Unexpected matches found", |
847 |
"src/p/A.java p.A [A]", |
848 |
resultCollector.toString()); |
849 |
} |
850 |
/* |
851 |
* Ensure search finds matches in an included package. |
852 |
* (case of opening the project) |
853 |
*/ |
854 |
public void testSearchWithIncludedPackage2() throws CoreException { |
855 |
setClasspath(new String[] {"/P/src", "p/"}); |
856 |
createFolder("/P/src/p"); |
857 |
createFile( |
858 |
"/P/src/p/A.java", |
859 |
"package p;\n" + |
860 |
"public class A {\n" + |
861 |
"}" |
862 |
); |
863 |
IProject p = this.project.getProject(); |
864 |
p.close(null); |
865 |
p.open(null); |
866 |
|
867 |
JavaSearchTests.JavaSearchResultCollector resultCollector = new JavaSearchTests.JavaSearchResultCollector(); |
868 |
search( |
869 |
"A", |
870 |
IJavaSearchConstants.TYPE, |
871 |
IJavaSearchConstants.DECLARATIONS, |
872 |
SearchEngine.createJavaSearchScope(new IJavaProject[] {getJavaProject("P")}), |
873 |
resultCollector); |
874 |
assertEquals( |
875 |
"Unexpected matches found", |
876 |
"src/p/A.java p.A [A]", |
821 |
resultCollector.toString()); |
877 |
resultCollector.toString()); |
822 |
} |
878 |
} |
823 |
/* |
879 |
/* |