void () { PsiFile file = myFixture.configureByFile(getTestName(false) + ".java"); PsiLocalVariable var = PsiTreeUtil.getParentOfType(file.findElementAt(myFixture.getCaretOffset()), PsiLocalVariable.class); assertNotNull(var); assertNotNull(var.getModifierList()); assertTrue("val should make variable final", var.getModifierList().hasModifierProperty(PsiModifier.FINAL)); }