use of com.intellij.psi.PsiClass in project kotlin by JetBrains.
the class LightClassEqualsTest method testEqualsForExplicitDeclaration.
public void testEqualsForExplicitDeclaration() throws Exception {
myFixture.configureByText("a.kt", "class A");
PsiClass theClass = myFixture.getJavaFacade().findClass("A");
assertNotNull(theClass);
assertInstanceOf(theClass, KtLightClassForSourceDeclaration.class);
doTestEquals(((KtLightClass) theClass).getKotlinOrigin());
}
use of com.intellij.psi.PsiClass in project kotlin by JetBrains.
the class AbstractSearcherTest method getPsiClass.
protected PsiClass getPsiClass(String className) {
PsiClass psiClass = JavaPsiFacade.getInstance(getProject()).findClass(className, getGlobalScope());
assertNotNull("Couldn't find a psiClass: " + className, psiClass);
return psiClass;
}
use of com.intellij.psi.PsiClass in project kotlin by JetBrains.
the class AbstractSearcherTest method checkResult.
protected void checkResult(Query<?> actual) throws IOException {
String text = FileUtil.loadFile(new File(getPathToFile()), true);
List<String> classFqnFilters = InTextDirectivesUtils.findListWithPrefixes(text, "// IGNORE_CLASSES: ");
List<String> actualModified = new ArrayList<String>();
for (Object member : actual) {
if (member instanceof PsiClass) {
final String qualifiedName = ((PsiClass) member).getQualifiedName();
assert qualifiedName != null;
boolean filterOut = CollectionsKt.any(classFqnFilters, new Function1<String, Boolean>() {
@Override
public Boolean invoke(String s) {
return qualifiedName.startsWith(s);
}
});
if (filterOut) {
continue;
}
}
actualModified.add(stringRepresentation(member));
}
Collections.sort(actualModified);
List<String> expected = InTextDirectivesUtils.findListWithPrefixes(text, "// SEARCH: ");
Collections.sort(expected);
assertOrderedEquals(actualModified, expected);
}
use of com.intellij.psi.PsiClass in project kotlin by JetBrains.
the class JUnitMembersSearcherTest method doJUnit4test.
private void doJUnit4test() throws IOException {
myFixture.configureByFile(getFileName());
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile()), true), "// ANNOTATION: ");
assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty());
String annotationClassName = directives.get(0);
PsiClass psiClass = getPsiClass(annotationClassName);
checkResult(AnnotatedMembersSearch.search(psiClass, getProjectScope()));
}
use of com.intellij.psi.PsiClass in project kotlin by JetBrains.
the class JUnitMembersSearcherTest method doJUnit3test.
private void doJUnit3test() throws IOException {
myFixture.configureByFile(getFileName());
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile()), true), "// CLASS: ");
assertFalse("Specify CLASS directive in test file", directives.isEmpty());
String superClassName = directives.get(0);
PsiClass psiClass = getPsiClass(superClassName);
checkResult(ClassInheritorsSearch.search(psiClass, getProjectScope(), false));
}
Aggregations