void () { final JavaPsiFacadeEx psiManager = getJavaFacade(); final PsiElementFactory factory = psiManager.getElementFactory(); final PsiClass classA = psiManager.findClass("A"); assertNotNull(classA); final PsiMethod method = classA.findMethodsByName("method", false)[0]; final PsiExpression expression = ((PsiExpressionStatement) method.getBody().getStatements()[1]).getExpression(); assertEquals("l.get(0)", expression.getText()); final PsiType type = expression.getType(); final PsiType listOfInteger = factory.createTypeFromText("test.List<java.lang.Integer>", null); assertEquals(listOfInteger, type); final PsiType collectionOfInteger = factory.createTypeFromText("test.Collection<java.lang.Integer>", null); assertTrue(collectionOfInteger.isAssignableFrom(type)); }