@Test public void beforeNotLayoutSpecSaving() { AtomicBoolean invoked = new AtomicBoolean(false); ComponentFileListener componentFileListener = new ComponentFileListener( psiClass -> { invoked.set(true); }); testHelper.getPsiClass( psiClasses -> { Assert.assertNotNull(psiClasses); PsiClass psiCls = psiClasses.get(0); PsiFile containingFile = psiCls.getContainingFile(); componentFileListener.beforeFileSaving(containingFile); return true; }, "MountSpec.java"); Assert.assertFalse(invoked.get()); }
@VisibleForTesting void beforeFileSaving(PsiFile psiFile) { LithoPluginUtils.getFirstLayoutSpec(psiFile).ifPresent(savingFileConsumer); }
ComponentFileListener implements FileDocumentManagerListener { @VisibleForTesting void beforeFileSaving(PsiFile psiFile) { LithoPluginUtils.getFirstLayoutSpec(psiFile).ifPresent(savingFileConsumer); } }
ComponentFileListener implements FileDocumentManagerListener { @VisibleForTesting void beforeFileSaving(PsiFile psiFile) { LithoPluginUtils.getFirstLayoutSpec(psiFile).ifPresent(savingFileConsumer); } ComponentFileListener(); @VisibleForTesting  ComponentFileListener(Consumer<PsiClass> savingFileConsumer); }
ComponentFileListener implements FileDocumentManagerListener { @VisibleForTesting void beforeFileSaving(PsiFile psiFile) { LithoPluginUtils.getFirstLayoutSpec(psiFile).ifPresent(savingFileConsumer); } ComponentFileListener(); @VisibleForTesting  ComponentFileListener(Consumer<PsiClass> savingFileConsumer); @Override void beforeAllDocumentsSaving(); @Override void beforeDocumentSaving(Document document); @Override void beforeFileContentReload(VirtualFile file, Document document); @Override void fileWithNoDocumentChanged(VirtualFile file); @Override void fileContentReloaded(VirtualFile file, Document document); @Override void fileContentLoaded(VirtualFile file, Document document); @Override void unsavedDocumentsDropped(); }
ComponentFileListener implements FileDocumentManagerListener { @VisibleForTesting void beforeFileSaving(PsiFile psiFile) { LithoPluginUtils.getFirstLayoutSpec(psiFile).ifPresent(savingFileConsumer); } ComponentFileListener(); @VisibleForTesting  ComponentFileListener(Consumer<PsiClass> savingFileConsumer); @Override void beforeAllDocumentsSaving(); @Override void beforeDocumentSaving(Document document); @Override void beforeFileContentReload(VirtualFile file, Document document); @Override void fileWithNoDocumentChanged(VirtualFile file); @Override void fileContentReloaded(VirtualFile file, Document document); @Override void fileContentLoaded(VirtualFile file, Document document); @Override void unsavedDocumentsDropped();  }