void () { PsiFile file = myFixture.configureByFile(getTestName(false) + ".java"); PsiField field = PsiTreeUtil.getParentOfType(file.findElementAt(myFixture.getCaretOffset()), PsiField.class); assertNotNull(field); assertNotNull(field.getModifierList()); PsiElement parent = field.getParent(); assertNotNull(parent); assertTrue(parent instanceof PsiClass); PsiClass parentClass = (PsiClass) parent; assertNotNull(parentClass.getModifierList()); assertTrue("@UtilityClass should make parent class final", parentClass.getModifierList().hasModifierProperty(PsiModifier.FINAL)); assertTrue("@UtilityClass should make field static", field.getModifierList().hasModifierProperty(PsiModifier.STATIC)); }