|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun * Microsystems, Inc. All Rights Reserved. */ /* * DataObjectTest_manipulation.java * * Tests ... * * Created on June 26, 2001, 3:39 PM */ package DataLoaderTests.DataObjectTest; import junit.framework.*; import org.netbeans.junit.*; public class DataObjectTest_validity extends NbTestCase { /** Creates new DataObjectTest_manipulation */ public DataObjectTest_validity(java.lang.String testName) { super(testName); } /**Allows this test to be executed inside ide*/ public static void main(java.lang.String[] args) { junit.textui.TestRunner.run(suite()); } /**This suite*/ public static Test suite() { NbTestSuite suite = new NbTestSuite(DataObjectTest_validity.class); return suite; } // boolean successful = true; DataObjectTest DOT = null; /** *Performs initializing before own tests starts */ void prepare() { try { //when not in XTest harness -> woring directory will be under actual userdir if (Manager.getWorkDirPath()==null) System.setProperty("nbjunit.workdir",System.getProperty("netbeans.user")); //clearWorkDir(); String newname = NAME.substring(NAME.lastIndexOf('/')+1,((NAME.lastIndexOf('.')==-1)?NAME.length():NAME.lastIndexOf('.'))); DOT = new DataObjectTest(getName()); System.out.println("Name: " + DOT.getName()); // successful = true; //next condition removes the last dot from folder if (NAME.endsWith(".")) NAME = NAME.substring(0,NAME.length()-1); DOT.prepare(); } catch (Exception e) { e.printStackTrace(); e.printStackTrace(getRef()); assertTrue("Initialization of test failed! ->" + e,false); } } /** *Performs clean up */ void clean() { DOT.clean(); } /** *Performs waiting of current thread for time in millis *@param millist integer number - time in millis to wait */ void dummyWait(int millis) { try { Thread.sleep(millis); } catch (Exception ex) { DOT.printException(ex); } } /** *Own test */ public void testDOValidity() throws Exception { prepare(); org.openide.loaders.DataObject testedDO = DataObjectTest.findResource(NAME); DOT.checkValidity(testedDO); clean(); //do not forget to merge the results! // successful = successful && DOT.successful; System.out.println("\n" + DOT.successful ); assertTrue("Validity test failed!",DOT.successful); } //if you want print exceptions into log file, put here true. public static final boolean PRINT_EXCEPTIONS = true; public static final String PASSED = "passed.\n"; public static final String FAILED = "failed.\n"; protected String NAME = "/DataObjects/JavaSourceObject.java";//null; } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.