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 expression1 = ((PsiExpressionStatement) method.getBody().getStatements()[1]).getExpression(); assertEquals("l.get(0)", expression1.getText()); final PsiType type1 = expression1.getType(); final PsiType typeListOfInteger = factory.createTypeFromText("test.List<java.lang.Integer>", null); assertEquals(typeListOfInteger, type1); assertTrue(typeListOfInteger.isAssignableFrom(type1)); final PsiExpression expression2 = ((PsiExpressionStatement) method.getBody().getStatements()[3]).getExpression(); assertEquals("b.get(0)", expression2.getText()); final PsiType type2 = expression2.getType(); assertEquals(typeListOfInteger, type2); }