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