boolean (PsiElement context) { PsiMethod method = PsiTreeUtil.getParentOfType(context, PsiMethod.class); if (method == null) { return false; } final PsiClass aClass = method.getContainingClass(); if (aClass == null) { return false; } final Set<TestFramework> frameworks = TestFrameworks.detectApplicableFrameworks(aClass); return ContainerUtil.exists(frameworks, framework -> framework.getName().equals("JUnit5") && framework.isTestMethod(method, false)); }