@Test public void getValidSpec_layoutspec() { testHelper.getPsiClass( psiClasses -> { AnActionEvent mock = createEvent(psiClasses.get(0)); assertTrue(GenerateComponentAction.getValidSpec(mock).isPresent()); return true; }, "LayoutSpec.java"); }
@VisibleForTesting static Optional<PsiClass> getValidSpec(AnActionEvent e) { return Optional.of(e) .map(event -> event.getData(CommonDataKeys.PSI_FILE)) .flatMap(LithoPluginUtils::getFirstLayoutSpec); }
GenerateComponentAction extends AnAction { @VisibleForTesting static Optional<PsiClass> getValidSpec(AnActionEvent e) { return Optional.of(e) .map(event -> event.getData(CommonDataKeys.PSI_FILE)) .flatMap(LithoPluginUtils::getFirstLayoutSpec); } }
GenerateComponentAction extends AnAction { @VisibleForTesting static Optional<PsiClass> getValidSpec(AnActionEvent e) { return Optional.of(e) .map(event -> event.getData(CommonDataKeys.PSI_FILE)) .flatMap(LithoPluginUtils::getFirstLayoutSpec); }  }
GenerateComponentAction extends AnAction { @VisibleForTesting static Optional<PsiClass> getValidSpec(AnActionEvent e) { return Optional.of(e) .map(event -> event.getData(CommonDataKeys.PSI_FILE)) .flatMap(LithoPluginUtils::getFirstLayoutSpec); }  @Override void update(AnActionEvent e); @Override void actionPerformed(AnActionEvent e); }
GenerateComponentAction extends AnAction { @VisibleForTesting static Optional<PsiClass> getValidSpec(AnActionEvent e) { return Optional.of(e) .map(event -> event.getData(CommonDataKeys.PSI_FILE)) .flatMap(LithoPluginUtils::getFirstLayoutSpec); }  @Override void update(AnActionEvent e); @Override void actionPerformed(AnActionEvent e);  }