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