1 19 20 27 28 package DataLoaderTests.DataObjectTest; 29 30 import junit.framework.*; 31 import org.netbeans.junit.*; 32 33 public class DataObjectTest_validity extends NbTestCase { 34 35 36 public DataObjectTest_validity(java.lang.String testName) { 37 super(testName); 38 } 39 40 41 public static void main(java.lang.String [] args) { 42 junit.textui.TestRunner.run(suite()); 43 } 44 45 46 public static Test suite() { 47 NbTestSuite suite = new NbTestSuite(DataObjectTest_validity.class); 48 return suite; 49 } 50 51 DataObjectTest DOT = null; 53 54 55 58 void prepare() { 59 try { 60 if (Manager.getWorkDirPath()==null) System.setProperty("nbjunit.workdir",System.getProperty("netbeans.user")); 62 String newname = NAME.substring(NAME.lastIndexOf('/')+1,((NAME.lastIndexOf('.')==-1)?NAME.length():NAME.lastIndexOf('.'))); 64 DOT = new DataObjectTest(getName()); 65 System.out.println("Name: " + DOT.getName()); 66 if (NAME.endsWith(".")) NAME = NAME.substring(0,NAME.length()-1); 69 DOT.prepare(); 70 } catch (Exception e) { 71 e.printStackTrace(); 72 e.printStackTrace(getRef()); 73 assertTrue("Initialization of test failed! ->" + e,false); 74 } 75 } 76 77 80 void clean() { 81 DOT.clean(); 82 } 83 84 88 void dummyWait(int millis) { 89 try { 90 Thread.sleep(millis); 91 } catch (Exception ex) { 92 DOT.printException(ex); 93 } 94 } 95 96 99 public void testDOValidity() throws Exception { 100 prepare(); 101 org.openide.loaders.DataObject testedDO = DataObjectTest.findResource(NAME); 102 DOT.checkValidity(testedDO); 103 clean(); 104 System.out.println("\n" + DOT.successful ); 107 assertTrue("Validity test failed!",DOT.successful); 108 } 109 110 public static final boolean PRINT_EXCEPTIONS = true; 112 113 public static final String PASSED = "passed.\n"; 114 public static final String FAILED = "failed.\n"; 115 116 protected String NAME = "/DataObjects/JavaSourceObject.java";} 118 | Popular Tags |