// Path: src/main/java/pl/mjedynak/idea/plugins/builder/psi/PsiHelper.java
// public class PsiHelper {
// 
//     public PsiFile getPsiFileFromEditor(Editor editor, Project project) {
//         return getPsiFile(editor, project);
//     }
// 
//     public PsiClass getPsiClassFromEditor(Editor editor, Project project) {
//         PsiClass psiClass = null;
//         PsiFile psiFile = getPsiFile(editor, project);
//         if (psiFile instanceof PsiClassOwner) {
//             PsiClass[] classes = ((PsiClassOwner) psiFile).getClasses();
//             if (classes.length == 1) {
//                 psiClass = classes[0];
//             }
//         }
//         return psiClass;
//     }
// 
//     private PsiFile getPsiFile(Editor editor, Project project) {
//         return PsiUtilBase.getPsiFileInEditor(editor, project);
//     }
// 
//     public PsiShortNamesCache getPsiShortNamesCache(Project project) {
//         return PsiShortNamesCache.getInstance(project);
//     }
// 
//     public PsiDirectory getDirectoryFromModuleAndPackageName(Module module, String packageName) {
//         PsiDirectory baseDir = PackageUtil.findPossiblePackageDirectoryInModule(module, packageName);
//         return PackageUtil.findOrCreateDirectoryForPackage(module, packageName, baseDir, true);
//     }
// 
//     public void navigateToClass(PsiClass psiClass) {
//         if (psiClass != null) {
//             Navigatable navigatable = getDescriptor(psiClass);
//             if (navigatable != null) {
//                 navigatable.navigate(true);
//             }
//         }
//     }
// 
//     public String checkIfClassCanBeCreated(PsiDirectory targetDirectory, String className) {
//         return RefactoringMessageUtil.checkCanCreateClass(targetDirectory, className);
//     }
// 
//     public JavaDirectoryService getJavaDirectoryService() {
//         return JavaDirectoryService.getInstance();
//     }
// 
//     public PsiPackage getPackage(PsiDirectory psiDirectory) {
//         return getJavaDirectoryService().getPackage(psiDirectory);
//     }
// 
//     public JavaPsiFacade getJavaPsiFacade(Project project) {
//         return JavaPsiFacade.getInstance(project);
//     }
// 
//     public CommandProcessor getCommandProcessor() {
//         return CommandProcessor.getInstance();
//     }
// 
//     public Application getApplication() {
//         return ApplicationManager.getApplication();
//     }
// 
//     public Module findModuleForPsiClass(PsiClass psiClass, Project project) {
//         return ModuleUtil.findModuleForFile(psiClass.getContainingFile().getVirtualFile(), project);
//     }
// }


import com.intellij.openapi.module.Module;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiFile;
import com.intellij.util.IncorrectOperationException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import pl.mjedynak.idea.plugins.builder.psi.PsiHelper;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;

package pl.mjedynak.idea.plugins.builder.gui;



@RunWith(MockitoJUnitRunner.class)
public class SelectDirectoryTest {

    private static final String PACKAGE_NAME = "packageName";
    private static final String CLASS_NAME = "className";
    private static final String ERROR_MESSAGE = "errorMessage";
    private static final String DIRECTORY_NAME = "directoryName";

    private SelectDirectory selectDirectory;

    @Mock private CreateBuilderDialog createBuilderDialog;

// Path: src/main/java/pl/mjedynak/idea/plugins/builder/psi/PsiHelper.java
// public class PsiHelper {
// 
//     public PsiFile getPsiFileFromEditor(Editor editor, Project project) {
//         return getPsiFile(editor, project);
//     }
// 
//     public PsiClass getPsiClassFromEditor(Editor editor, Project project) {
//         PsiClass psiClass = null;
//         PsiFile psiFile = getPsiFile(editor, project);
//         if (psiFile instanceof PsiClassOwner) {
//             PsiClass[] classes = ((PsiClassOwner) psiFile).getClasses();
//             if (classes.length == 1) {
//                 psiClass = classes[0];
//             }
//         }
//         return psiClass;
//     }
// 
//     private PsiFile getPsiFile(Editor editor, Project project) {
//         return PsiUtilBase.getPsiFileInEditor(editor, project);
//     }
// 
//     public PsiShortNamesCache getPsiShortNamesCache(Project project) {
//         return PsiShortNamesCache.getInstance(project);
//     }
// 
//     public PsiDirectory getDirectoryFromModuleAndPackageName(Module module, String packageName) {
//         PsiDirectory baseDir = PackageUtil.findPossiblePackageDirectoryInModule(module, packageName);
//         return PackageUtil.findOrCreateDirectoryForPackage(module, packageName, baseDir, true);
//     }
// 
//     public void navigateToClass(PsiClass psiClass) {
//         if (psiClass != null) {
//             Navigatable navigatable = getDescriptor(psiClass);
//             if (navigatable != null) {
//                 navigatable.navigate(true);
//             }
//         }
//     }
// 
//     public String checkIfClassCanBeCreated(PsiDirectory targetDirectory, String className) {
//         return RefactoringMessageUtil.checkCanCreateClass(targetDirectory, className);
//     }
// 
//     public JavaDirectoryService getJavaDirectoryService() {
//         return JavaDirectoryService.getInstance();
//     }
// 
//     public PsiPackage getPackage(PsiDirectory psiDirectory) {
//         return getJavaDirectoryService().getPackage(psiDirectory);
//     }
// 
//     public JavaPsiFacade getJavaPsiFacade(Project project) {
//         return JavaPsiFacade.getInstance(project);
//     }
// 
//     public CommandProcessor getCommandProcessor() {
//         return CommandProcessor.getInstance();
//     }
// 
//     public Application getApplication() {
//         return ApplicationManager.getApplication();
//     }
// 
//     public Module findModuleForPsiClass(PsiClass psiClass, Project project) {
//         return ModuleUtil.findModuleForFile(psiClass.getContainingFile().getVirtualFile(), project);
//     }
// }


// Path: src/test/java/pl/mjedynak/idea/plugins/builder/gui/SelectDirectoryTest.java
import com.intellij.openapi.module.Module;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiFile;
import com.intellij.util.IncorrectOperationException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import pl.mjedynak.idea.plugins.builder.psi.PsiHelper;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;

package pl.mjedynak.idea.plugins.builder.gui;



@RunWith(MockitoJUnitRunner.class)
public class SelectDirectoryTest {

    private static final String PACKAGE_NAME = "packageName";
    private static final String CLASS_NAME = "className";
    private static final String ERROR_MESSAGE = "errorMessage";
    private static final String DIRECTORY_NAME = "directoryName";

    private SelectDirectory selectDirectory;

    @Mock private CreateBuilderDialog createBuilderDialog;

    @Mock private PsiHelper psiHelper;
