@Override
  protected boolean isValidForClass(PsiClass targetClass) {
    List<TestFramework> frameworks = TestIntegrationUtils.findSuitableFrameworks(targetClass);
    if (frameworks.isEmpty()) return false;

    for (TestFramework each : frameworks) {
      if (isValidFor(targetClass, each)) return true;
    }
    return false;
  }
 @Nullable
 @Override
 public AnAction createEditTemplateAction(DataContext dataContext) {
   final Project project = CommonDataKeys.PROJECT.getData(dataContext);
   final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
   final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
   final PsiClass targetClass =
       editor == null || file == null ? null : getTargetClass(editor, file);
   if (targetClass != null) {
     final List<TestFramework> frameworks =
         TestIntegrationUtils.findSuitableFrameworks(targetClass);
     final TestIntegrationUtils.MethodKind methodKind = ((MyHandler) getHandler()).myMethodKind;
     if (!frameworks.isEmpty()) {
       return new AnAction("Edit Template") {
         @Override
         public void actionPerformed(AnActionEvent e) {
           chooseAndPerform(
               editor,
               frameworks,
               new Consumer<TestFramework>() {
                 @Override
                 public void consume(TestFramework framework) {
                   final FileTemplateDescriptor descriptor =
                       methodKind.getFileTemplateDescriptor(framework);
                   if (descriptor != null) {
                     final String fileName = descriptor.getFileName();
                     AllFileTemplatesConfigurable.editCodeTemplate(
                         FileUtil.getNameWithoutExtension(fileName), project);
                   } else {
                     HintManager.getInstance()
                         .showErrorHint(
                             editor,
                             "No template found for "
                                 + framework.getName()
                                 + ":"
                                 + BaseGenerateTestSupportMethodAction.this
                                     .getTemplatePresentation()
                                     .getText());
                   }
                 }
               });
         }
       };
     }
   }
   return null;
 }
    public void invoke(
        @NotNull Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
      final PsiClass targetClass = findTargetClass(editor, file);
      final List<TestFramework> frameworks =
          new ArrayList<TestFramework>(TestIntegrationUtils.findSuitableFrameworks(targetClass));
      for (Iterator<TestFramework> iterator = frameworks.iterator(); iterator.hasNext(); ) {
        if (myMethodKind.getFileTemplateDescriptor(iterator.next()) == null) {
          iterator.remove();
        }
      }
      if (frameworks.isEmpty()) return;
      final Consumer<TestFramework> consumer =
          new Consumer<TestFramework>() {
            @Override
            public void consume(TestFramework framework) {
              if (framework == null) return;
              doGenerate(editor, file, targetClass, framework);
            }
          };

      chooseAndPerform(editor, frameworks, consumer);
    }