1 19 20 package org.netbeans.modules.java.j2seproject.ui.wizards; 21 22 import java.io.File ; 23 import org.netbeans.junit.NbTestCase; 24 25 26 30 public class PanelSourceFoldersTest extends NbTestCase { 31 32 public PanelSourceFoldersTest (java.lang.String testName) { 33 super(testName); 34 } 35 36 public void testCheckValidity () throws Exception { 37 38 File root = getWorkDir(); 39 File projectDir = new File (root, "project"); 40 File test = new File (root, "tests"); 41 test.mkdir(); 42 File src = new File (root, "src"); 43 src.mkdir(); 44 File badSrcDir = new File (root, "badSrc"); 45 File badSrcDir2 = new File (test, "src"); 46 badSrcDir2.mkdir(); 47 File badProjectDir = new File (root, "badPrjDir"); 48 badProjectDir.mkdir(); 49 badProjectDir.setReadOnly(); 50 51 assertNotNull("Empty name", PanelProjectLocationExtSrc.checkValidity ("",projectDir.getAbsolutePath())); 52 assertNotNull("Read Only WorkDir", PanelProjectLocationExtSrc.checkValidity ("",badProjectDir.getAbsolutePath())); 53 assertNotNull("Non Existent Sources", PanelSourceFolders.checkValidity (projectDir, new File [] {badSrcDir} , new File [] {test})); 54 assertFalse("Sources == Tests", FolderList.isValidRoot (src, new File [] {src},projectDir)); 55 assertFalse("Tests under Sources", FolderList.isValidRoot (new File (src, "Tests"),new File [] {src},projectDir)); 56 assertFalse("Sources under Tests", FolderList.isValidRoot (badSrcDir2, new File [] {test},projectDir)); 57 assertNull ("Valid data", PanelSourceFolders.checkValidity (projectDir, new File []{src}, new File []{test})); 58 } 59 } | Popular Tags |