void () { PsiCodeFragment codeFragment = JavaCodeFragmentFactory.getInstance(getProject()).createExpressionCodeFragment( "Boolean.getBoolean(\"true\")", null, null, true); PsiElement[] fileContent = codeFragment.getChildren(); assertEquals(1, fileContent.length); assertTrue(fileContent[0] instanceof PsiExpression); PsiExpression expr = (PsiExpression) fileContent[0]; assertNotNull(expr.getType()); assertEquals("boolean", expr.getType().getCanonicalText()); }