void () { myFixture.configureByText("a.java", """ class A { { new A().get<caret>Bar().toString(); } } """); PsiExpression expr = PsiTreeUtil.getParentOfType(getFile().findElementAt(getEditor().getCaretModel().getOffset()), PsiExpression.class); ExpectedTypeInfo[] types = ExpectedTypesProvider.getExpectedTypes(expr, false); assertNotNull( ContainerUtil.find(types, info -> info.getDefaultType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT))); }