void () { PsiFile file = myFixture.configureByText("a.java", "import lombok.val;\nclass Foo { {val o = <caret>;} }"); PsiLocalVariable var = PsiTreeUtil.getParentOfType(file.findElementAt(myFixture.getCaretOffset()), PsiLocalVariable.class); assertNotNull(var); PsiType type1 = var.getType(); assertNotNull(type1); assertEquals("lombok.val", type1.getCanonicalText(false)); myFixture.type('1'); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); assertTrue(var.isValid()); assertNotNull(var.getModifierList()); assertTrue("val should make variable final", var.getModifierList().hasModifierProperty(PsiModifier.FINAL)); }